118 #ifndef PY_SSIZE_T_CLEAN
119 #define PY_SSIZE_T_CLEAN
123 #error Python headers needed to compile C extensions, please install development version of Python.
124 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
125 #error Cython requires Python 2.6+ or Python 3.3+.
127 #define CYTHON_ABI "0_29_36"
128 #define CYTHON_HEX_VERSION 0x001D24F0
129 #define CYTHON_FUTURE_DIVISION 1
132 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
134 #if !defined(WIN32) && !defined(MS_WINDOWS)
146 #define DL_IMPORT(t) t
149 #define DL_EXPORT(t) t
151 #define __PYX_COMMA ,
152 #ifndef HAVE_LONG_LONG
153 #if PY_VERSION_HEX >= 0x02070000
154 #define HAVE_LONG_LONG
158 #define PY_LONG_LONG LONG_LONG
161 #define Py_HUGE_VAL HUGE_VAL
164 #define CYTHON_COMPILING_IN_PYPY 1
165 #define CYTHON_COMPILING_IN_PYSTON 0
166 #define CYTHON_COMPILING_IN_CPYTHON 0
167 #define CYTHON_COMPILING_IN_NOGIL 0
168 #undef CYTHON_USE_TYPE_SLOTS
169 #define CYTHON_USE_TYPE_SLOTS 0
170 #undef CYTHON_USE_PYTYPE_LOOKUP
171 #define CYTHON_USE_PYTYPE_LOOKUP 0
172 #if PY_VERSION_HEX < 0x03050000
173 #undef CYTHON_USE_ASYNC_SLOTS
174 #define CYTHON_USE_ASYNC_SLOTS 0
175 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
176 #define CYTHON_USE_ASYNC_SLOTS 1
178 #undef CYTHON_USE_PYLIST_INTERNALS
179 #define CYTHON_USE_PYLIST_INTERNALS 0
180 #undef CYTHON_USE_UNICODE_INTERNALS
181 #define CYTHON_USE_UNICODE_INTERNALS 0
182 #undef CYTHON_USE_UNICODE_WRITER
183 #define CYTHON_USE_UNICODE_WRITER 0
184 #undef CYTHON_USE_PYLONG_INTERNALS
185 #define CYTHON_USE_PYLONG_INTERNALS 0
186 #undef CYTHON_AVOID_BORROWED_REFS
187 #define CYTHON_AVOID_BORROWED_REFS 1
188 #undef CYTHON_ASSUME_SAFE_MACROS
189 #define CYTHON_ASSUME_SAFE_MACROS 0
190 #undef CYTHON_UNPACK_METHODS
191 #define CYTHON_UNPACK_METHODS 0
192 #undef CYTHON_FAST_THREAD_STATE
193 #define CYTHON_FAST_THREAD_STATE 0
194 #undef CYTHON_FAST_PYCALL
195 #define CYTHON_FAST_PYCALL 0
196 #if PY_VERSION_HEX < 0x03090000
197 #undef CYTHON_PEP489_MULTI_PHASE_INIT
198 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
199 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
200 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
202 #undef CYTHON_USE_TP_FINALIZE
203 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
204 #undef CYTHON_USE_DICT_VERSIONS
205 #define CYTHON_USE_DICT_VERSIONS 0
206 #undef CYTHON_USE_EXC_INFO_STACK
207 #define CYTHON_USE_EXC_INFO_STACK 0
208 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
209 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
211 #elif defined(PYSTON_VERSION)
212 #define CYTHON_COMPILING_IN_PYPY 0
213 #define CYTHON_COMPILING_IN_PYSTON 1
214 #define CYTHON_COMPILING_IN_CPYTHON 0
215 #define CYTHON_COMPILING_IN_NOGIL 0
216 #ifndef CYTHON_USE_TYPE_SLOTS
217 #define CYTHON_USE_TYPE_SLOTS 1
219 #undef CYTHON_USE_PYTYPE_LOOKUP
220 #define CYTHON_USE_PYTYPE_LOOKUP 0
221 #undef CYTHON_USE_ASYNC_SLOTS
222 #define CYTHON_USE_ASYNC_SLOTS 0
223 #undef CYTHON_USE_PYLIST_INTERNALS
224 #define CYTHON_USE_PYLIST_INTERNALS 0
225 #ifndef CYTHON_USE_UNICODE_INTERNALS
226 #define CYTHON_USE_UNICODE_INTERNALS 1
228 #undef CYTHON_USE_UNICODE_WRITER
229 #define CYTHON_USE_UNICODE_WRITER 0
230 #undef CYTHON_USE_PYLONG_INTERNALS
231 #define CYTHON_USE_PYLONG_INTERNALS 0
232 #ifndef CYTHON_AVOID_BORROWED_REFS
233 #define CYTHON_AVOID_BORROWED_REFS 0
235 #ifndef CYTHON_ASSUME_SAFE_MACROS
236 #define CYTHON_ASSUME_SAFE_MACROS 1
238 #ifndef CYTHON_UNPACK_METHODS
239 #define CYTHON_UNPACK_METHODS 1
241 #undef CYTHON_FAST_THREAD_STATE
242 #define CYTHON_FAST_THREAD_STATE 0
243 #undef CYTHON_FAST_PYCALL
244 #define CYTHON_FAST_PYCALL 0
245 #undef CYTHON_PEP489_MULTI_PHASE_INIT
246 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
247 #undef CYTHON_USE_TP_FINALIZE
248 #define CYTHON_USE_TP_FINALIZE 0
249 #undef CYTHON_USE_DICT_VERSIONS
250 #define CYTHON_USE_DICT_VERSIONS 0
251 #undef CYTHON_USE_EXC_INFO_STACK
252 #define CYTHON_USE_EXC_INFO_STACK 0
253 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
254 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
256 #elif defined(PY_NOGIL)
257 #define CYTHON_COMPILING_IN_PYPY 0
258 #define CYTHON_COMPILING_IN_PYSTON 0
259 #define CYTHON_COMPILING_IN_CPYTHON 0
260 #define CYTHON_COMPILING_IN_NOGIL 1
261 #ifndef CYTHON_USE_TYPE_SLOTS
262 #define CYTHON_USE_TYPE_SLOTS 1
264 #undef CYTHON_USE_PYTYPE_LOOKUP
265 #define CYTHON_USE_PYTYPE_LOOKUP 0
266 #ifndef CYTHON_USE_ASYNC_SLOTS
267 #define CYTHON_USE_ASYNC_SLOTS 1
269 #undef CYTHON_USE_PYLIST_INTERNALS
270 #define CYTHON_USE_PYLIST_INTERNALS 0
271 #ifndef CYTHON_USE_UNICODE_INTERNALS
272 #define CYTHON_USE_UNICODE_INTERNALS 1
274 #undef CYTHON_USE_UNICODE_WRITER
275 #define CYTHON_USE_UNICODE_WRITER 0
276 #undef CYTHON_USE_PYLONG_INTERNALS
277 #define CYTHON_USE_PYLONG_INTERNALS 0
278 #ifndef CYTHON_AVOID_BORROWED_REFS
279 #define CYTHON_AVOID_BORROWED_REFS 0
281 #ifndef CYTHON_ASSUME_SAFE_MACROS
282 #define CYTHON_ASSUME_SAFE_MACROS 1
284 #ifndef CYTHON_UNPACK_METHODS
285 #define CYTHON_UNPACK_METHODS 1
287 #undef CYTHON_FAST_THREAD_STATE
288 #define CYTHON_FAST_THREAD_STATE 0
289 #undef CYTHON_FAST_PYCALL
290 #define CYTHON_FAST_PYCALL 0
291 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
292 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
294 #ifndef CYTHON_USE_TP_FINALIZE
295 #define CYTHON_USE_TP_FINALIZE 1
297 #undef CYTHON_USE_DICT_VERSIONS
298 #define CYTHON_USE_DICT_VERSIONS 0
299 #undef CYTHON_USE_EXC_INFO_STACK
300 #define CYTHON_USE_EXC_INFO_STACK 0
302 #define CYTHON_COMPILING_IN_PYPY 0
303 #define CYTHON_COMPILING_IN_PYSTON 0
304 #define CYTHON_COMPILING_IN_CPYTHON 1
305 #define CYTHON_COMPILING_IN_NOGIL 0
306 #ifndef CYTHON_USE_TYPE_SLOTS
307 #define CYTHON_USE_TYPE_SLOTS 1
309 #if PY_VERSION_HEX < 0x02070000
310 #undef CYTHON_USE_PYTYPE_LOOKUP
311 #define CYTHON_USE_PYTYPE_LOOKUP 0
312 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
313 #define CYTHON_USE_PYTYPE_LOOKUP 1
315 #if PY_MAJOR_VERSION < 3
316 #undef CYTHON_USE_ASYNC_SLOTS
317 #define CYTHON_USE_ASYNC_SLOTS 0
318 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
319 #define CYTHON_USE_ASYNC_SLOTS 1
321 #if PY_VERSION_HEX < 0x02070000
322 #undef CYTHON_USE_PYLONG_INTERNALS
323 #define CYTHON_USE_PYLONG_INTERNALS 0
324 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
325 #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5)
327 #ifndef CYTHON_USE_PYLIST_INTERNALS
328 #define CYTHON_USE_PYLIST_INTERNALS 1
330 #ifndef CYTHON_USE_UNICODE_INTERNALS
331 #define CYTHON_USE_UNICODE_INTERNALS 1
333 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
334 #undef CYTHON_USE_UNICODE_WRITER
335 #define CYTHON_USE_UNICODE_WRITER 0
336 #elif !defined(CYTHON_USE_UNICODE_WRITER)
337 #define CYTHON_USE_UNICODE_WRITER 1
339 #ifndef CYTHON_AVOID_BORROWED_REFS
340 #define CYTHON_AVOID_BORROWED_REFS 0
342 #ifndef CYTHON_ASSUME_SAFE_MACROS
343 #define CYTHON_ASSUME_SAFE_MACROS 1
345 #ifndef CYTHON_UNPACK_METHODS
346 #define CYTHON_UNPACK_METHODS 1
348 #if PY_VERSION_HEX >= 0x030B00A4
349 #undef CYTHON_FAST_THREAD_STATE
350 #define CYTHON_FAST_THREAD_STATE 0
351 #elif !defined(CYTHON_FAST_THREAD_STATE)
352 #define CYTHON_FAST_THREAD_STATE 1
354 #ifndef CYTHON_FAST_PYCALL
355 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
357 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
358 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
360 #ifndef CYTHON_USE_TP_FINALIZE
361 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
363 #ifndef CYTHON_USE_DICT_VERSIONS
364 #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5))
366 #if PY_VERSION_HEX >= 0x030B00A4
367 #undef CYTHON_USE_EXC_INFO_STACK
368 #define CYTHON_USE_EXC_INFO_STACK 0
369 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
370 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
372 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
373 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
376 #if !defined(CYTHON_FAST_PYCCALL)
377 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
379 #if CYTHON_USE_PYLONG_INTERNALS
380 #if PY_MAJOR_VERSION < 3
381 #include "longintrepr.h"
387 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
390 #ifndef __has_attribute
391 #define __has_attribute(x) 0
393 #ifndef __has_cpp_attribute
394 #define __has_cpp_attribute(x) 0
396 #ifndef CYTHON_RESTRICT
397 #if defined(__GNUC__)
398 #define CYTHON_RESTRICT __restrict__
399 #elif defined(_MSC_VER) && _MSC_VER >= 1400
400 #define CYTHON_RESTRICT __restrict
401 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
402 #define CYTHON_RESTRICT restrict
404 #define CYTHON_RESTRICT
407 #ifndef CYTHON_UNUSED
408 # if defined(__GNUC__)
409 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
410 # define CYTHON_UNUSED __attribute__ ((__unused__))
412 # define CYTHON_UNUSED
414 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
415 # define CYTHON_UNUSED __attribute__ ((__unused__))
417 # define CYTHON_UNUSED
420 #ifndef CYTHON_MAYBE_UNUSED_VAR
421 # if defined(__cplusplus)
422 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
424 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
427 #ifndef CYTHON_NCP_UNUSED
428 # if CYTHON_COMPILING_IN_CPYTHON
429 # define CYTHON_NCP_UNUSED
431 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
434 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
436 #ifndef _MSC_STDINT_H_
438 typedef unsigned char uint8_t;
439 typedef unsigned int uint32_t;
441 typedef unsigned __int8 uint8_t;
442 typedef unsigned __int32 uint32_t;
448 #ifndef CYTHON_FALLTHROUGH
449 #if defined(__cplusplus) && __cplusplus >= 201103L
450 #if __has_cpp_attribute(fallthrough)
451 #define CYTHON_FALLTHROUGH [[fallthrough]]
452 #elif __has_cpp_attribute(clang::fallthrough)
453 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
454 #elif __has_cpp_attribute(gnu::fallthrough)
455 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
458 #ifndef CYTHON_FALLTHROUGH
459 #if __has_attribute(fallthrough)
460 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
462 #define CYTHON_FALLTHROUGH
465 #if defined(__clang__ ) && defined(__apple_build_version__)
466 #if __apple_build_version__ < 7000000
467 #undef CYTHON_FALLTHROUGH
468 #define CYTHON_FALLTHROUGH
474 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
476 #ifndef CYTHON_INLINE
477 #if defined(__clang__)
478 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
480 #define CYTHON_INLINE inline
484 void __Pyx_call_destructor(T& x) {
488 class __Pyx_FakeReference {
490 __Pyx_FakeReference() : ptr(NULL) { }
491 __Pyx_FakeReference(
const T& ref) : ptr(const_cast<T*>(&ref)) { }
492 T *operator->() {
return ptr; }
493 T *operator&() {
return ptr; }
494 operator T&() {
return *ptr; }
495 template<
typename U>
bool operator ==(U other) {
return *ptr == other; }
496 template<
typename U>
bool operator !=(U other) {
return *ptr != other; }
501 #define __PYX_BUILD_PY_SSIZE_T "n"
502 #define CYTHON_FORMAT_SSIZE_T "z"
503 #if PY_MAJOR_VERSION < 3
504 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
505 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
506 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
507 #define __Pyx_DefaultClassType PyClass_Type
509 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
510 #define __Pyx_DefaultClassType PyType_Type
511 #if PY_VERSION_HEX >= 0x030B00A1
512 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(
int a,
int k,
int l,
int s,
int f,
513 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
514 PyObject *fv, PyObject *cell, PyObject* fn,
515 PyObject *name,
int fline, PyObject *lnos) {
516 PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
517 PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
518 const char *fn_cstr=NULL;
519 const char *name_cstr=NULL;
520 PyCodeObject* co=NULL;
521 PyObject *type, *value, *traceback;
522 PyErr_Fetch(&type, &value, &traceback);
523 if (!(kwds=PyDict_New()))
goto end;
524 if (!(argcount=PyLong_FromLong(a)))
goto end;
525 if (PyDict_SetItemString(kwds,
"co_argcount", argcount) != 0)
goto end;
526 if (!(posonlyargcount=PyLong_FromLong(0)))
goto end;
527 if (PyDict_SetItemString(kwds,
"co_posonlyargcount", posonlyargcount) != 0)
goto end;
528 if (!(kwonlyargcount=PyLong_FromLong(k)))
goto end;
529 if (PyDict_SetItemString(kwds,
"co_kwonlyargcount", kwonlyargcount) != 0)
goto end;
530 if (!(nlocals=PyLong_FromLong(l)))
goto end;
531 if (PyDict_SetItemString(kwds,
"co_nlocals", nlocals) != 0)
goto end;
532 if (!(stacksize=PyLong_FromLong(s)))
goto end;
533 if (PyDict_SetItemString(kwds,
"co_stacksize", stacksize) != 0)
goto end;
534 if (!(flags=PyLong_FromLong(f)))
goto end;
535 if (PyDict_SetItemString(kwds,
"co_flags", flags) != 0)
goto end;
536 if (PyDict_SetItemString(kwds,
"co_code", code) != 0)
goto end;
537 if (PyDict_SetItemString(kwds,
"co_consts", c) != 0)
goto end;
538 if (PyDict_SetItemString(kwds,
"co_names", n) != 0)
goto end;
539 if (PyDict_SetItemString(kwds,
"co_varnames", v) != 0)
goto end;
540 if (PyDict_SetItemString(kwds,
"co_freevars", fv) != 0)
goto end;
541 if (PyDict_SetItemString(kwds,
"co_cellvars", cell) != 0)
goto end;
542 if (PyDict_SetItemString(kwds,
"co_linetable", lnos) != 0)
goto end;
543 if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL)))
goto end;
544 if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL)))
goto end;
545 if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline)))
goto end;
546 if (!(replace = PyObject_GetAttrString((PyObject*)co,
"replace")))
goto cleanup_code_too;
547 if (!(empty = PyTuple_New(0)))
goto cleanup_code_too;
548 if (!(call_result = PyObject_Call(replace, empty, kwds)))
goto cleanup_code_too;
549 Py_XDECREF((PyObject*)co);
550 co = (PyCodeObject*)call_result;
554 Py_XDECREF((PyObject*)co);
559 Py_XDECREF(argcount);
560 Py_XDECREF(posonlyargcount);
561 Py_XDECREF(kwonlyargcount);
563 Py_XDECREF(stacksize);
565 Py_XDECREF(call_result);
568 PyErr_Restore(type, value, traceback);
573 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
574 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
576 #define __Pyx_DefaultClassType PyType_Type
578 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
579 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
581 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
583 #ifndef Py_TPFLAGS_CHECKTYPES
584 #define Py_TPFLAGS_CHECKTYPES 0
586 #ifndef Py_TPFLAGS_HAVE_INDEX
587 #define Py_TPFLAGS_HAVE_INDEX 0
589 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
590 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
592 #ifndef Py_TPFLAGS_HAVE_FINALIZE
593 #define Py_TPFLAGS_HAVE_FINALIZE 0
595 #ifndef METH_STACKLESS
596 #define METH_STACKLESS 0
598 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
599 #ifndef METH_FASTCALL
600 #define METH_FASTCALL 0x80
602 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
603 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
604 Py_ssize_t nargs, PyObject *kwnames);
606 #define __Pyx_PyCFunctionFast _PyCFunctionFast
607 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
609 #if CYTHON_FAST_PYCCALL
610 #define __Pyx_PyFastCFunction_Check(func)\
611 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
613 #define __Pyx_PyFastCFunction_Check(func) 0
615 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
616 #define PyObject_Malloc(s) PyMem_Malloc(s)
617 #define PyObject_Free(p) PyMem_Free(p)
618 #define PyObject_Realloc(p) PyMem_Realloc(p)
620 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
621 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
622 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
623 #define PyMem_RawFree(p) PyMem_Free(p)
625 #if CYTHON_COMPILING_IN_PYSTON
626 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
627 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
629 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
630 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
632 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
633 #define __Pyx_PyThreadState_Current PyThreadState_GET()
634 #elif PY_VERSION_HEX >= 0x03060000
635 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
636 #elif PY_VERSION_HEX >= 0x03000000
637 #define __Pyx_PyThreadState_Current PyThreadState_GET()
639 #define __Pyx_PyThreadState_Current _PyThreadState_Current
641 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
642 #include "pythread.h"
643 #define Py_tss_NEEDS_INIT 0
644 typedef int Py_tss_t;
645 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
646 *key = PyThread_create_key();
649 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
650 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
651 *key = Py_tss_NEEDS_INIT;
654 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
657 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
658 return *key != Py_tss_NEEDS_INIT;
660 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
661 PyThread_delete_key(*key);
662 *key = Py_tss_NEEDS_INIT;
664 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
665 return PyThread_set_key_value(*key, value);
667 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
668 return PyThread_get_key_value(*key);
671 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
672 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
674 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
676 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
677 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
678 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
680 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
681 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
683 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
684 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
686 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
688 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
689 #define CYTHON_PEP393_ENABLED 1
690 #if PY_VERSION_HEX >= 0x030C0000
691 #define __Pyx_PyUnicode_READY(op) (0)
693 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
694 0 : _PyUnicode_Ready((PyObject *)(op)))
696 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
697 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
698 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
699 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
700 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
701 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
702 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
703 #if PY_VERSION_HEX >= 0x030C0000
704 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
706 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
707 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
709 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
713 #define CYTHON_PEP393_ENABLED 0
714 #define PyUnicode_1BYTE_KIND 1
715 #define PyUnicode_2BYTE_KIND 2
716 #define PyUnicode_4BYTE_KIND 4
717 #define __Pyx_PyUnicode_READY(op) (0)
718 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
719 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
720 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
721 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
722 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
723 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
724 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
725 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
727 #if CYTHON_COMPILING_IN_PYPY
728 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
729 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
731 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
732 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
733 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
735 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
736 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
738 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
739 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
741 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
742 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
744 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
745 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
746 #if PY_MAJOR_VERSION >= 3
747 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
749 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
751 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
752 #define PyObject_ASCII(o) PyObject_Repr(o)
754 #if PY_MAJOR_VERSION >= 3
755 #define PyBaseString_Type PyUnicode_Type
756 #define PyStringObject PyUnicodeObject
757 #define PyString_Type PyUnicode_Type
758 #define PyString_Check PyUnicode_Check
759 #define PyString_CheckExact PyUnicode_CheckExact
760 #ifndef PyObject_Unicode
761 #define PyObject_Unicode PyObject_Str
764 #if PY_MAJOR_VERSION >= 3
765 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
766 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
768 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
769 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
771 #ifndef PySet_CheckExact
772 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
774 #if PY_VERSION_HEX >= 0x030900A4
775 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
776 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
778 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
779 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
781 #if CYTHON_ASSUME_SAFE_MACROS
782 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
784 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
786 #if PY_MAJOR_VERSION >= 3
787 #define PyIntObject PyLongObject
788 #define PyInt_Type PyLong_Type
789 #define PyInt_Check(op) PyLong_Check(op)
790 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
791 #define PyInt_FromString PyLong_FromString
792 #define PyInt_FromUnicode PyLong_FromUnicode
793 #define PyInt_FromLong PyLong_FromLong
794 #define PyInt_FromSize_t PyLong_FromSize_t
795 #define PyInt_FromSsize_t PyLong_FromSsize_t
796 #define PyInt_AsLong PyLong_AsLong
797 #define PyInt_AS_LONG PyLong_AS_LONG
798 #define PyInt_AsSsize_t PyLong_AsSsize_t
799 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
800 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
801 #define PyNumber_Int PyNumber_Long
803 #if PY_MAJOR_VERSION >= 3
804 #define PyBoolObject PyLongObject
806 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
807 #ifndef PyUnicode_InternFromString
808 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
811 #if PY_VERSION_HEX < 0x030200A4
812 typedef long Py_hash_t;
813 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
814 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
816 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
817 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
819 #if PY_MAJOR_VERSION >= 3
820 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
822 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
824 #if CYTHON_USE_ASYNC_SLOTS
825 #if PY_VERSION_HEX >= 0x030500B1
826 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
827 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
829 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
832 #define __Pyx_PyType_AsAsync(obj) NULL
834 #ifndef __Pyx_PyAsyncMethodsStruct
839 } __Pyx_PyAsyncMethodsStruct;
842 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
843 #if !defined(_USE_MATH_DEFINES)
844 #define _USE_MATH_DEFINES
849 #define __PYX_NAN() ((float) NAN)
851 static CYTHON_INLINE
float __PYX_NAN() {
853 memset(&value, 0xFF,
sizeof(value));
857 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
858 #define __Pyx_truncl trunc
860 #define __Pyx_truncl truncl
863 #define __PYX_MARK_ERR_POS(f_index, lineno) \
864 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
865 #define __PYX_ERR(f_index, lineno, Ln_error) \
866 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
868 #ifndef __PYX_EXTERN_C
870 #define __PYX_EXTERN_C extern "C"
872 #define __PYX_EXTERN_C extern
876 #define __PYX_HAVE__imate__traceinv___hutchinson_method
877 #define __PYX_HAVE_API__imate__traceinv___hutchinson_method
882 #include "pythread.h"
891 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
892 #define CYTHON_WITHOUT_ASSERTIONS
895 typedef struct {PyObject **p;
const char *s;
const Py_ssize_t n;
const char* encoding;
896 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
898 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
899 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
900 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
901 #define __PYX_DEFAULT_STRING_ENCODING ""
902 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
903 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
904 #define __Pyx_uchar_cast(c) ((unsigned char)c)
905 #define __Pyx_long_cast(x) ((long)x)
906 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
907 (sizeof(type) < sizeof(Py_ssize_t)) ||\
908 (sizeof(type) > sizeof(Py_ssize_t) &&\
909 likely(v < (type)PY_SSIZE_T_MAX ||\
910 v == (type)PY_SSIZE_T_MAX) &&\
911 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
912 v == (type)PY_SSIZE_T_MIN))) ||\
913 (sizeof(type) == sizeof(Py_ssize_t) &&\
914 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
915 v == (type)PY_SSIZE_T_MAX))) )
916 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
917 return (
size_t) i < (size_t) limit;
919 #if defined (__cplusplus) && __cplusplus >= 201103L
921 #define __Pyx_sst_abs(value) std::abs(value)
922 #elif SIZEOF_INT >= SIZEOF_SIZE_T
923 #define __Pyx_sst_abs(value) abs(value)
924 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
925 #define __Pyx_sst_abs(value) labs(value)
926 #elif defined (_MSC_VER)
927 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
928 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
929 #define __Pyx_sst_abs(value) llabs(value)
930 #elif defined (__GNUC__)
931 #define __Pyx_sst_abs(value) __builtin_llabs(value)
933 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
935 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
936 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
937 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
938 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
939 #define __Pyx_PyBytes_FromString PyBytes_FromString
940 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
941 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
942 #if PY_MAJOR_VERSION < 3
943 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
944 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
946 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
947 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
949 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
950 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
951 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
952 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
953 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
954 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
955 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
956 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
957 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
958 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
959 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
960 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
961 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
962 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
963 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
964 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
965 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *u) {
966 const Py_UNICODE *u_end = u;
968 return (
size_t)(u_end - u - 1);
970 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
971 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
972 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
973 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
974 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
975 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
976 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
977 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
978 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
979 #define __Pyx_PySequence_Tuple(obj)\
980 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
981 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
982 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
983 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
984 #if CYTHON_ASSUME_SAFE_MACROS
985 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
987 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
989 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
990 #if PY_MAJOR_VERSION >= 3
991 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
993 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
995 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
996 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
997 static int __Pyx_sys_getdefaultencoding_not_ascii;
998 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
1000 PyObject* default_encoding = NULL;
1001 PyObject* ascii_chars_u = NULL;
1002 PyObject* ascii_chars_b = NULL;
1003 const char* default_encoding_c;
1004 sys = PyImport_ImportModule(
"sys");
1006 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
1008 if (!default_encoding)
goto bad;
1009 default_encoding_c = PyBytes_AsString(default_encoding);
1010 if (!default_encoding_c)
goto bad;
1011 if (strcmp(default_encoding_c,
"ascii") == 0) {
1012 __Pyx_sys_getdefaultencoding_not_ascii = 0;
1014 char ascii_chars[128];
1016 for (c = 0; c < 128; c++) {
1019 __Pyx_sys_getdefaultencoding_not_ascii = 1;
1020 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
1021 if (!ascii_chars_u)
goto bad;
1022 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
1023 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
1026 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1027 default_encoding_c);
1030 Py_DECREF(ascii_chars_u);
1031 Py_DECREF(ascii_chars_b);
1033 Py_DECREF(default_encoding);
1036 Py_XDECREF(default_encoding);
1037 Py_XDECREF(ascii_chars_u);
1038 Py_XDECREF(ascii_chars_b);
1042 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1043 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1045 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1046 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1047 static char* __PYX_DEFAULT_STRING_ENCODING;
1048 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
1050 PyObject* default_encoding = NULL;
1051 char* default_encoding_c;
1052 sys = PyImport_ImportModule(
"sys");
1054 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
1056 if (!default_encoding)
goto bad;
1057 default_encoding_c = PyBytes_AsString(default_encoding);
1058 if (!default_encoding_c)
goto bad;
1059 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
1060 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
1061 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1062 Py_DECREF(default_encoding);
1065 Py_XDECREF(default_encoding);
1073 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1074 #define likely(x) __builtin_expect(!!(x), 1)
1075 #define unlikely(x) __builtin_expect(!!(x), 0)
1077 #define likely(x) (x)
1078 #define unlikely(x) (x)
1080 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
1082 static PyObject *__pyx_m = NULL;
1083 static PyObject *__pyx_d;
1084 static PyObject *__pyx_b;
1085 static PyObject *__pyx_cython_runtime = NULL;
1086 static PyObject *__pyx_empty_tuple;
1087 static PyObject *__pyx_empty_bytes;
1088 static PyObject *__pyx_empty_unicode;
1089 static int __pyx_lineno;
1090 static int __pyx_clineno = 0;
1091 static const char * __pyx_cfilenm= __FILE__;
1092 static const char *__pyx_filename;
1095 static const char *__pyx_f[] = {
1096 "imate/traceinv/_hutchinson_method.pyx",
1100 struct __pyx_memoryview_obj;
1102 struct __pyx_memoryview_obj *memview;
1104 Py_ssize_t shape[8];
1105 Py_ssize_t strides[8];
1106 Py_ssize_t suboffsets[8];
1107 } __Pyx_memviewslice;
1108 #define __Pyx_MemoryView_Len(m) (m.shape[0])
1111 #include <pythread.h>
1112 #ifndef CYTHON_ATOMICS
1113 #define CYTHON_ATOMICS 1
1115 #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
1116 #define __pyx_atomic_int_type int
1117 #if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
1118 (__GNUC_MINOR__ > 1 ||\
1119 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
1120 #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1)
1121 #define __pyx_atomic_decr_aligned(value) __sync_fetch_and_sub(value, 1)
1122 #ifdef __PYX_DEBUG_ATOMICS
1123 #warning "Using GNU atomics"
1125 #elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL
1127 #undef __pyx_atomic_int_type
1128 #define __pyx_atomic_int_type long
1129 #pragma intrinsic (_InterlockedExchangeAdd)
1130 #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1)
1131 #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1)
1132 #ifdef __PYX_DEBUG_ATOMICS
1133 #pragma message ("Using MSVC atomics")
1136 #undef CYTHON_ATOMICS
1137 #define CYTHON_ATOMICS 0
1138 #ifdef __PYX_DEBUG_ATOMICS
1139 #warning "Not using atomics"
1142 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
1144 #define __pyx_add_acquisition_count(memview)\
1145 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview))
1146 #define __pyx_sub_acquisition_count(memview)\
1147 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview))
1149 #define __pyx_add_acquisition_count(memview)\
1150 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1151 #define __pyx_sub_acquisition_count(memview)\
1152 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1156 #ifndef __PYX_FORCE_INIT_THREADS
1157 #define __PYX_FORCE_INIT_THREADS 0
1161 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1162 #define __Pyx_PyGILState_Release PyGILState_Release
1163 #define __Pyx_FastGIL_Remember()
1164 #define __Pyx_FastGIL_Forget()
1165 #define __Pyx_FastGilFuncInit()
1168 #define IS_UNSIGNED(type) (((type) -1) > 0)
1169 struct __Pyx_StructField_;
1170 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
1173 struct __Pyx_StructField_* fields;
1175 size_t arraysize[8];
1181 typedef struct __Pyx_StructField_ {
1182 __Pyx_TypeInfo* type;
1185 } __Pyx_StructField;
1187 __Pyx_StructField* field;
1188 size_t parent_offset;
1189 } __Pyx_BufFmt_StackElem;
1191 __Pyx_StructField root;
1192 __Pyx_BufFmt_StackElem* head;
1194 size_t new_count, enc_count;
1195 size_t struct_alignment;
1200 char is_valid_array;
1201 } __Pyx_BufFmt_Context;
1211 typedef int __pyx_t_5imate_12_definitions_5types_IndexType;
1220 typedef int __pyx_t_5imate_12_definitions_5types_FlagType;
1223 struct __pyx_array_obj;
1224 struct __pyx_MemviewEnum_obj;
1225 struct __pyx_memoryview_obj;
1226 struct __pyx_memoryviewslice_obj;
1235 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewLongIndexType;
1244 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType;
1253 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType;
1262 typedef double (*__pyx_t_5imate_12_definitions_5types_kernel_type)(
double const ,
double const );
1271 struct __pyx_array_obj {
1273 struct __pyx_vtabstruct_array *__pyx_vtab;
1279 Py_ssize_t *_strides;
1280 Py_ssize_t itemsize;
1283 void (*callback_free_data)(
void *);
1285 int dtype_is_object;
1296 struct __pyx_MemviewEnum_obj {
1309 struct __pyx_memoryview_obj {
1311 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1314 PyObject *_array_interface;
1315 PyThread_type_lock lock;
1316 __pyx_atomic_int acquisition_count[2];
1317 __pyx_atomic_int *acquisition_count_aligned_p;
1320 int dtype_is_object;
1321 __Pyx_TypeInfo *typeinfo;
1332 struct __pyx_memoryviewslice_obj {
1333 struct __pyx_memoryview_obj __pyx_base;
1334 __Pyx_memviewslice from_slice;
1335 PyObject *from_object;
1336 PyObject *(*to_object_func)(
char *);
1337 int (*to_dtype_func)(
char *, PyObject *);
1350 struct __pyx_vtabstruct_array {
1351 PyObject *(*get_memview)(
struct __pyx_array_obj *);
1353 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1364 struct __pyx_vtabstruct_memoryview {
1365 char *(*get_item_pointer)(
struct __pyx_memoryview_obj *, PyObject *);
1366 PyObject *(*is_slice)(
struct __pyx_memoryview_obj *, PyObject *);
1367 PyObject *(*setitem_slice_assignment)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1368 PyObject *(*setitem_slice_assign_scalar)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *);
1369 PyObject *(*setitem_indexed)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1370 PyObject *(*convert_item_to_object)(
struct __pyx_memoryview_obj *,
char *);
1371 PyObject *(*assign_item_from_object)(
struct __pyx_memoryview_obj *,
char *, PyObject *);
1373 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1384 struct __pyx_vtabstruct__memoryviewslice {
1385 struct __pyx_vtabstruct_memoryview __pyx_base;
1387 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1391 #ifndef CYTHON_REFNANNY
1392 #define CYTHON_REFNANNY 0
1396 void (*INCREF)(
void*, PyObject*, int);
1397 void (*DECREF)(
void*, PyObject*, int);
1398 void (*GOTREF)(
void*, PyObject*, int);
1399 void (*GIVEREF)(
void*, PyObject*, int);
1400 void* (*SetupContext)(
const char*, int,
const char*);
1401 void (*FinishContext)(
void**);
1402 } __Pyx_RefNannyAPIStruct;
1403 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1404 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1405 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1407 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1409 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1410 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1411 PyGILState_Release(__pyx_gilstate_save);\
1413 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1416 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1417 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1419 #define __Pyx_RefNannyFinishContext()\
1420 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1421 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1422 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1423 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1424 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1425 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1426 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1427 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1428 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1430 #define __Pyx_RefNannyDeclarations
1431 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1432 #define __Pyx_RefNannyFinishContext()
1433 #define __Pyx_INCREF(r) Py_INCREF(r)
1434 #define __Pyx_DECREF(r) Py_DECREF(r)
1435 #define __Pyx_GOTREF(r)
1436 #define __Pyx_GIVEREF(r)
1437 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1438 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1439 #define __Pyx_XGOTREF(r)
1440 #define __Pyx_XGIVEREF(r)
1442 #define __Pyx_XDECREF_SET(r, v) do {\
1443 PyObject *tmp = (PyObject *) r;\
1444 r = v; __Pyx_XDECREF(tmp);\
1446 #define __Pyx_DECREF_SET(r, v) do {\
1447 PyObject *tmp = (PyObject *) r;\
1448 r = v; __Pyx_DECREF(tmp);\
1450 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1451 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1454 #if CYTHON_USE_TYPE_SLOTS
1455 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1457 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1461 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1464 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
1467 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1468 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1469 const char* function_name);
1472 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
1473 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1476 #if CYTHON_FAST_THREAD_STATE
1477 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1478 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1479 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1481 #define __Pyx_PyThreadState_declare
1482 #define __Pyx_PyThreadState_assign
1483 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1487 #if CYTHON_FAST_THREAD_STATE
1488 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1489 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1490 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1491 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1492 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1493 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1494 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1495 #if CYTHON_COMPILING_IN_CPYTHON
1496 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1498 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1501 #define __Pyx_PyErr_Clear() PyErr_Clear()
1502 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1503 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1504 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1505 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1506 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1507 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1508 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1512 #ifndef CYTHON_PROFILE
1513 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
1514 #define CYTHON_PROFILE 0
1516 #define CYTHON_PROFILE 1
1519 #ifndef CYTHON_TRACE_NOGIL
1520 #define CYTHON_TRACE_NOGIL 0
1522 #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
1523 #define CYTHON_TRACE 1
1526 #ifndef CYTHON_TRACE
1527 #define CYTHON_TRACE 0
1530 #undef CYTHON_PROFILE_REUSE_FRAME
1532 #ifndef CYTHON_PROFILE_REUSE_FRAME
1533 #define CYTHON_PROFILE_REUSE_FRAME 0
1535 #if CYTHON_PROFILE || CYTHON_TRACE
1536 #include "compile.h"
1537 #include "frameobject.h"
1538 #include "traceback.h"
1539 #if PY_VERSION_HEX >= 0x030b00a6
1540 #ifndef Py_BUILD_CORE
1541 #define Py_BUILD_CORE 1
1543 #include "internal/pycore_frame.h"
1545 #if CYTHON_PROFILE_REUSE_FRAME
1546 #define CYTHON_FRAME_MODIFIER static
1547 #define CYTHON_FRAME_DEL(frame)
1549 #define CYTHON_FRAME_MODIFIER
1550 #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
1552 #define __Pyx_TraceDeclarations\
1553 static PyCodeObject *__pyx_frame_code = NULL;\
1554 CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
1555 int __Pyx_use_tracing = 0;
1556 #define __Pyx_TraceFrameInit(codeobj)\
1557 if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
1558 #if PY_VERSION_HEX >= 0x030b00a2
1559 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1560 (unlikely((tstate)->cframe->use_tracing) &&\
1561 (!(check_tracing) || !(tstate)->tracing) &&\
1562 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1563 #define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate)
1564 #define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate)
1565 #elif PY_VERSION_HEX >= 0x030a00b1
1566 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1567 (unlikely((tstate)->cframe->use_tracing) &&\
1568 (!(check_tracing) || !(tstate)->tracing) &&\
1569 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1570 #define __Pyx_EnterTracing(tstate)\
1571 do { tstate->tracing++; tstate->cframe->use_tracing = 0; } while (0)
1572 #define __Pyx_LeaveTracing(tstate)\
1575 tstate->cframe->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
1576 || tstate->c_profilefunc != NULL);\
1579 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1580 (unlikely((tstate)->use_tracing) &&\
1581 (!(check_tracing) || !(tstate)->tracing) &&\
1582 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1583 #define __Pyx_EnterTracing(tstate)\
1584 do { tstate->tracing++; tstate->use_tracing = 0; } while (0)
1585 #define __Pyx_LeaveTracing(tstate)\
1588 tstate->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
1589 || tstate->c_profilefunc != NULL);\
1593 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1595 if (CYTHON_TRACE_NOGIL) {\
1596 PyThreadState *tstate;\
1597 PyGILState_STATE state = PyGILState_Ensure();\
1598 tstate = __Pyx_PyThreadState_Current;\
1599 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1600 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1602 PyGILState_Release(state);\
1603 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1606 PyThreadState* tstate = PyThreadState_GET();\
1607 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1608 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1609 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1613 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1614 { PyThreadState* tstate = PyThreadState_GET();\
1615 if (__Pyx_IsTracing(tstate, 1, 1)) {\
1616 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1617 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1621 #define __Pyx_TraceException()\
1622 if (likely(!__Pyx_use_tracing)); else {\
1623 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1624 if (__Pyx_IsTracing(tstate, 0, 1)) {\
1625 __Pyx_EnterTracing(tstate);\
1626 PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
1628 if (CYTHON_TRACE && tstate->c_tracefunc)\
1629 tstate->c_tracefunc(\
1630 tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1631 tstate->c_profilefunc(\
1632 tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1633 Py_DECREF(exc_info);\
1635 __Pyx_LeaveTracing(tstate);\
1638 static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
1639 PyObject *type, *value, *traceback;
1640 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1641 __Pyx_EnterTracing(tstate);
1642 if (CYTHON_TRACE && tstate->c_tracefunc)
1643 tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
1644 if (tstate->c_profilefunc)
1645 tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
1646 CYTHON_FRAME_DEL(frame);
1647 __Pyx_LeaveTracing(tstate);
1648 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1651 #define __Pyx_TraceReturn(result, nogil)\
1652 if (likely(!__Pyx_use_tracing)); else {\
1654 if (CYTHON_TRACE_NOGIL) {\
1655 PyThreadState *tstate;\
1656 PyGILState_STATE state = PyGILState_Ensure();\
1657 tstate = __Pyx_PyThreadState_Current;\
1658 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1659 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1661 PyGILState_Release(state);\
1664 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1665 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1666 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1671 #define __Pyx_TraceReturn(result, nogil)\
1672 if (likely(!__Pyx_use_tracing)); else {\
1673 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1674 if (__Pyx_IsTracing(tstate, 0, 0)) {\
1675 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1679 static PyCodeObject *__Pyx_createFrameCodeObject(
const char *funcname,
const char *srcfile,
int firstlineno);
1680 static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate,
const char *funcname,
const char *srcfile,
int firstlineno);
1682 #define __Pyx_TraceDeclarations
1683 #define __Pyx_TraceFrameInit(codeobj)
1684 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if ((1)); else goto_error;
1685 #define __Pyx_TraceException()
1686 #define __Pyx_TraceReturn(result, nogil)
1689 static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame,
int lineno) {
1691 PyObject *type, *value, *traceback;
1692 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1693 __Pyx_PyFrame_SetLineNumber(frame, lineno);
1694 __Pyx_EnterTracing(tstate);
1695 ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
1696 __Pyx_LeaveTracing(tstate);
1698 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1702 Py_XDECREF(traceback);
1707 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1708 if (likely(!__Pyx_use_tracing)); else {\
1710 if (CYTHON_TRACE_NOGIL) {\
1712 PyThreadState *tstate;\
1713 PyGILState_STATE state = PyGILState_Ensure();\
1714 tstate = __Pyx_PyThreadState_Current;\
1715 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1716 ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1718 PyGILState_Release(state);\
1719 if (unlikely(ret)) goto_error;\
1722 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1723 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1724 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1725 if (unlikely(ret)) goto_error;\
1730 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1731 if (likely(!__Pyx_use_tracing)); else {\
1732 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1733 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1734 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1735 if (unlikely(ret)) goto_error;\
1740 #define __Pyx_TraceLine(lineno, nogil, goto_error) if ((1)); else goto_error;
1744 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1745 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1746 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1747 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1748 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1749 (cache_var) = (value);
1750 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1751 static PY_UINT64_T __pyx_dict_version = 0;\
1752 static PyObject *__pyx_dict_cached_value = NULL;\
1753 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1754 (VAR) = __pyx_dict_cached_value;\
1756 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1757 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1760 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1761 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1762 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1764 #define __PYX_GET_DICT_VERSION(dict) (0)
1765 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1766 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1770 #if CYTHON_USE_DICT_VERSIONS
1771 #define __Pyx_GetModuleGlobalName(var, name) do {\
1772 static PY_UINT64_T __pyx_dict_version = 0;\
1773 static PyObject *__pyx_dict_cached_value = NULL;\
1774 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1775 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1776 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1778 #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
1779 PY_UINT64_T __pyx_dict_version;\
1780 PyObject *__pyx_dict_cached_value;\
1781 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1783 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1785 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1786 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1787 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1791 #if CYTHON_FAST_PYCALL
1792 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1793 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1794 #if 1 || PY_VERSION_HEX < 0x030600B1
1795 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1797 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1799 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1800 (sizeof(char [1 - 2*!(cond)]) - 1)
1801 #ifndef Py_MEMBER_SIZE
1802 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1804 #if CYTHON_FAST_PYCALL
1805 static size_t __pyx_pyframe_localsplus_offset = 0;
1806 #include "frameobject.h"
1807 #if PY_VERSION_HEX >= 0x030b00a6
1808 #ifndef Py_BUILD_CORE
1809 #define Py_BUILD_CORE 1
1811 #include "internal/pycore_frame.h"
1813 #define __Pxy_PyFrame_Initialize_Offsets()\
1814 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1815 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1816 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1817 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1822 #if CYTHON_FAST_PYCCALL
1823 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1825 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1829 #if CYTHON_COMPILING_IN_CPYTHON
1830 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1832 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1836 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1839 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1842 static CYTHON_INLINE
int __Pyx_IterFinish(
void);
1845 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1848 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1849 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1850 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1851 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1852 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1853 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1854 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1855 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1856 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1857 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1858 int wraparound,
int boundscheck);
1859 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1860 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1861 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1862 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1863 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1864 int wraparound,
int boundscheck);
1865 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1866 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1867 int is_list,
int wraparound,
int boundscheck);
1870 #if CYTHON_COMPILING_IN_CPYTHON
1871 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1875 #if CYTHON_COMPILING_IN_CPYTHON
1876 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1878 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1882 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1885 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2);
1891 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
1894 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1897 #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
1898 __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
1899 static CYTHON_INLINE
int __Pyx_PyObject_SetSlice(
1900 PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
1901 PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1902 int has_cstart,
int has_cstop,
int wraparound);
1905 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2,
long intval,
long inplace);
1908 #if PY_VERSION_HEX >= 0x03050000
1909 #define __Pyx_PyNumber_MatrixMultiply(x,y) PyNumber_MatrixMultiply(x,y)
1910 #define __Pyx_PyNumber_InPlaceMatrixMultiply(x,y) PyNumber_InPlaceMatrixMultiply(x,y)
1912 #define __Pyx_PyNumber_MatrixMultiply(x,y) __Pyx__PyNumber_MatrixMultiply(x, y, "@")
1913 static PyObject* __Pyx__PyNumber_MatrixMultiply(PyObject* x, PyObject* y,
const char* op_name);
1914 static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y);
1918 #if CYTHON_USE_TYPE_SLOTS
1919 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1921 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1925 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1926 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1927 __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1928 (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1929 __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1930 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1931 static CYTHON_INLINE
int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1932 int is_list,
int wraparound,
int boundscheck);
1935 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1936 #define __Pyx_MEMVIEW_DIRECT 1
1937 #define __Pyx_MEMVIEW_PTR 2
1938 #define __Pyx_MEMVIEW_FULL 4
1939 #define __Pyx_MEMVIEW_CONTIG 8
1940 #define __Pyx_MEMVIEW_STRIDED 16
1941 #define __Pyx_MEMVIEW_FOLLOW 32
1942 #define __Pyx_IS_C_CONTIG 1
1943 #define __Pyx_IS_F_CONTIG 2
1944 static int __Pyx_init_memviewslice(
1945 struct __pyx_memoryview_obj *memview,
1947 __Pyx_memviewslice *memviewslice,
1948 int memview_is_new_reference);
1949 static CYTHON_INLINE
int __pyx_add_acquisition_count_locked(
1950 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1951 static CYTHON_INLINE
int __pyx_sub_acquisition_count_locked(
1952 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1953 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1954 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1955 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1956 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1957 static CYTHON_INLINE
void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1958 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1961 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname);
1964 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1965 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1966 __Pyx__ArgTypeTest(obj, type, name, exact))
1967 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact);
1970 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
1973 #if PY_MAJOR_VERSION >= 3
1974 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1976 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1980 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1981 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1983 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1985 static void __Pyx_WriteUnraisable(
const char *name,
int clineno,
1986 int lineno,
const char *filename,
1987 int full_traceback,
int nogil);
1989 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *);
1991 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1994 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(
const char *s, Py_ssize_t size,
const char *errors) {
1996 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1998 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(
const char *s, Py_ssize_t size,
const char *errors) {
2000 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2002 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(
const char *s, Py_ssize_t size,
const char *errors) {
2004 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2008 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
2009 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
2010 const char* encoding,
const char* errors,
2011 PyObject* (*decode_func)(
const char *s, Py_ssize_t size,
const char *errors));
2014 #if CYTHON_FAST_THREAD_STATE
2015 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
2016 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
2018 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
2022 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
2025 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void);
2028 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
2031 #if CYTHON_USE_EXC_INFO_STACK
2032 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
2036 #if CYTHON_FAST_THREAD_STATE
2037 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
2038 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2039 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
2040 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
2042 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
2043 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
2047 #if CYTHON_FAST_THREAD_STATE
2048 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
2049 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2051 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
2055 #if CYTHON_FAST_THREAD_STATE
2056 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
2057 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2059 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
2063 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
2066 #if CYTHON_COMPILING_IN_CPYTHON
2067 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2068 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2069 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2070 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2072 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2073 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2074 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2076 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2078 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2080 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2081 static CYTHON_INLINE
int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
2082 PyListObject* L = (PyListObject*) list;
2083 Py_ssize_t len = Py_SIZE(list);
2084 if (likely(L->allocated > len)) {
2086 PyList_SET_ITEM(list, len, x);
2087 __Pyx_SET_SIZE(list, len + 1);
2090 return PyList_Append(list, x);
2093 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
2097 #if !CYTHON_COMPILING_IN_PYPY
2098 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2,
long intval,
int inplace,
int zerodivision_check);
2100 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
2101 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
2105 static CYTHON_INLINE
int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
2106 #if CYTHON_COMPILING_IN_CPYTHON
2107 PyObject* none = _PyList_Extend((PyListObject*)L, v);
2108 if (unlikely(!none))
2113 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
2118 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2119 static CYTHON_INLINE
int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
2120 PyListObject* L = (PyListObject*) list;
2121 Py_ssize_t len = Py_SIZE(list);
2122 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
2124 PyList_SET_ITEM(list, len, x);
2125 __Pyx_SET_SIZE(list, len + 1);
2128 return PyList_Append(list, x);
2131 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
2135 #define __Pyx_init_assertions_enabled()
2136 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
2137 #define __pyx_assertions_enabled() (1)
2138 #elif PY_VERSION_HEX < 0x03080000 || CYTHON_COMPILING_IN_PYPY || defined(Py_LIMITED_API)
2139 #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
2140 #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6
2141 static int __pyx_assertions_enabled_flag;
2142 #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
2143 #undef __Pyx_init_assertions_enabled
2144 static void __Pyx_init_assertions_enabled(
void) {
2145 __pyx_assertions_enabled_flag = ! _PyInterpreterState_GetConfig(__Pyx_PyThreadState_Current->interp)->optimization_level;
2148 #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
2152 static CYTHON_INLINE
int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq,
int eq) {
2153 int result = PySequence_Contains(seq, item);
2154 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
2158 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2161 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *, PyObject *);
2164 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2165 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2167 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2171 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2172 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2174 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2178 static int __Pyx_SetVtable(PyObject *dict,
void *vtable);
2181 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2184 static int __Pyx_setup_reduce(PyObject* type_obj);
2187 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2190 #define __Pyx_CyFunction_USED 1
2191 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
2192 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
2193 #define __Pyx_CYFUNCTION_CCLASS 0x04
2194 #define __Pyx_CyFunction_GetClosure(f)\
2195 (((__pyx_CyFunctionObject *) (f))->func_closure)
2196 #define __Pyx_CyFunction_GetClassObj(f)\
2197 (((__pyx_CyFunctionObject *) (f))->func_classobj)
2198 #define __Pyx_CyFunction_Defaults(type, f)\
2199 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2200 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2201 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2203 PyCFunctionObject func;
2204 #if PY_VERSION_HEX < 0x030500A0
2205 PyObject *func_weakreflist;
2207 PyObject *func_dict;
2208 PyObject *func_name;
2209 PyObject *func_qualname;
2211 PyObject *func_globals;
2212 PyObject *func_code;
2213 PyObject *func_closure;
2214 PyObject *func_classobj;
2216 int defaults_pyobjects;
2217 size_t defaults_size;
2219 PyObject *defaults_tuple;
2220 PyObject *defaults_kwdict;
2221 PyObject *(*defaults_getter)(PyObject *);
2222 PyObject *func_annotations;
2223 } __pyx_CyFunctionObject;
2224 static PyTypeObject *__pyx_CyFunctionType = 0;
2225 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
2226 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2227 int flags, PyObject* qualname,
2229 PyObject *module, PyObject *globals,
2231 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2234 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2236 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2238 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2240 static int __pyx_CyFunction_init(
void);
2243 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2244 int flags, PyObject* qualname,
2246 PyObject *module, PyObject *globals,
2250 #ifdef CYTHON_CLINE_IN_TRACEBACK
2251 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2253 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
2258 PyCodeObject* code_object;
2260 } __Pyx_CodeObjectCacheEntry;
2261 struct __Pyx_CodeObjectCache {
2264 __Pyx_CodeObjectCacheEntry* entries;
2266 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2267 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
2268 static PyCodeObject *__pyx_find_code_object(
int code_line);
2269 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
2272 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
2273 int py_line,
const char *filename);
2275 #if PY_MAJOR_VERSION < 3
2276 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
2277 static void __Pyx_ReleaseBuffer(Py_buffer *view);
2279 #define __Pyx_GetBuffer PyObject_GetBuffer
2280 #define __Pyx_ReleaseBuffer PyBuffer_Release
2286 Py_ssize_t shape, strides, suboffsets;
2287 } __Pyx_Buf_DimInfo;
2293 __Pyx_Buffer *rcbuffer;
2295 __Pyx_Buf_DimInfo diminfo[8];
2296 } __Pyx_LocalBuf_ND;
2299 static int __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim);
2302 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2303 __Pyx_memviewslice *slice2,
2304 int ndim,
size_t itemsize);
2307 static CYTHON_INLINE PyObject *__pyx_capsule_create(
void *p,
const char *sig);
2310 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2311 #define __Pyx_HAS_GCC_DIAGNOSTIC
2315 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void);
2318 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts);
2319 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2320 __Pyx_BufFmt_StackElem* stack,
2321 __Pyx_TypeInfo* type);
2324 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2327 static int __Pyx_ValidateAndInit_memviewslice(
2332 __Pyx_TypeInfo *dtype,
2333 __Pyx_BufFmt_StackElem stack[],
2334 __Pyx_memviewslice *memviewslice,
2335 PyObject *original_obj);
2338 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__float(PyObject *,
int writable_flag);
2341 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__double(PyObject *,
int writable_flag);
2344 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *,
int writable_flag);
2347 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *,
int writable_flag);
2350 static __Pyx_memviewslice
2351 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
2352 const char *mode,
int ndim,
2353 size_t sizeof_dtype,
int contig_flag,
2354 int dtype_is_object);
2357 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
2360 static CYTHON_INLINE
LongIndexType __Pyx_PyInt_As_LongIndexType(PyObject *);
2363 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
2366 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
2369 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
2372 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
2375 static int __Pyx_check_binary_version(
void);
2378 static int __Pyx_ImportFunction_0_29_36(PyObject *module,
const char *funcname,
void (**f)(
void),
const char *sig);
2381 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2383 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self);
2384 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2385 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj);
2386 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src);
2387 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value);
2388 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2389 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp);
2390 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2391 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp);
2392 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2401 static void (*__pyx_fuse_0__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors)(
float *,
LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const );
2402 static void (*__pyx_fuse_1__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors)(
double *,
LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const );
2403 static void (*__pyx_fuse_2__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors)(
long double *,
LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const );
2406 static void (*__pyx_fuse_0__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors)(
float *,
LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const );
2407 static void (*__pyx_fuse_1__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors)(
double *,
LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const );
2408 static void (*__pyx_fuse_2__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors)(
long double *,
LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const );
2413 static PyTypeObject *__pyx_array_type = 0;
2414 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2415 static PyTypeObject *__pyx_memoryview_type = 0;
2416 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2417 static PyObject *
generic = 0;
2418 static PyObject *strided = 0;
2419 static PyObject *indirect = 0;
2420 static PyObject *contiguous = 0;
2421 static PyObject *indirect_contiguous = 0;
2422 static int __pyx_memoryview_thread_locks_used;
2423 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2424 static float __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_float(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *);
2425 static double __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_double(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *);
2426 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t,
char *,
char *,
char *);
2427 static void *__pyx_align_pointer(
void *,
size_t);
2428 static PyObject *__pyx_memoryview_new(PyObject *,
int,
int, __Pyx_TypeInfo *);
2429 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *);
2430 static PyObject *_unellipsify(PyObject *,
int);
2431 static PyObject *assert_direct_dimensions(Py_ssize_t *,
int);
2432 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *, PyObject *);
2433 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int,
int);
2434 static char *__pyx_pybuffer_index(Py_buffer *,
char *, Py_ssize_t, Py_ssize_t);
2435 static int __pyx_memslice_transpose(__Pyx_memviewslice *);
2436 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice,
int, PyObject *(*)(
char *),
int (*)(
char *, PyObject *),
int);
2437 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2438 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2439 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *);
2440 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2441 static Py_ssize_t abs_py_ssize_t(Py_ssize_t);
2442 static char __pyx_get_best_slice_order(__Pyx_memviewslice *,
int);
2443 static void _copy_strided_to_strided(
char *, Py_ssize_t *,
char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *,
int,
size_t);
2444 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *,
int,
size_t);
2445 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *,
int);
2446 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t,
int,
char);
2447 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *,
char,
int);
2448 static int __pyx_memoryview_err_extents(
int, Py_ssize_t, Py_ssize_t);
2449 static int __pyx_memoryview_err_dim(PyObject *,
char *,
int);
2450 static int __pyx_memoryview_err(PyObject *,
char *);
2451 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice,
int,
int,
int);
2452 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *,
int,
int);
2453 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *,
int,
int,
int);
2454 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2455 static void __pyx_memoryview_refcount_objects_in_slice(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2456 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *,
int,
size_t,
void *,
int);
2457 static void __pyx_memoryview__slice_assign_scalar(
char *, Py_ssize_t *, Py_ssize_t *,
int,
size_t,
void *);
2458 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *, PyObject *);
2459 static __Pyx_TypeInfo __Pyx_TypeInfo_float = {
"float", NULL,
sizeof(float), { 0 }, 0,
'R', 0, 0 };
2460 static __Pyx_TypeInfo __Pyx_TypeInfo_double = {
"double", NULL,
sizeof(double), { 0 }, 0,
'R', 0, 0 };
2461 #define __Pyx_MODULE_NAME "imate.traceinv._hutchinson_method"
2462 extern int __pyx_module_is_main_imate__traceinv___hutchinson_method;
2463 int __pyx_module_is_main_imate__traceinv___hutchinson_method = 0;
2466 static PyObject *__pyx_builtin_TypeError;
2467 static PyObject *__pyx_builtin_range;
2468 static PyObject *__pyx_builtin_RuntimeError;
2469 static PyObject *__pyx_builtin_ValueError;
2470 static PyObject *__pyx_builtin_MemoryError;
2471 static PyObject *__pyx_builtin_enumerate;
2472 static PyObject *__pyx_builtin_Ellipsis;
2473 static PyObject *__pyx_builtin_id;
2474 static PyObject *__pyx_builtin_IndexError;
2475 static const char __pyx_k_A[] =
"A";
2476 static const char __pyx_k_B[] =
"B";
2477 static const char __pyx_k_C[] =
"C";
2478 static const char __pyx_k_E[] =
"E";
2479 static const char __pyx_k_F[] =
"F";
2480 static const char __pyx_k_O[] =
"O";
2481 static const char __pyx_k_T[] =
"T";
2482 static const char __pyx_k_c[] =
"c";
2483 static const char __pyx_k_i[] =
"i";
2484 static const char __pyx_k_p[] =
"p";
2485 static const char __pyx_k_BE[] =
"BE";
2486 static const char __pyx_k_cE[] =
"cE";
2487 static const char __pyx_k_id[] =
"id";
2488 static const char __pyx_k_AtA[] =
"AtA";
2489 static const char __pyx_k_OpE[] =
"OpE";
2490 static const char __pyx_k_abs[] =
"abs";
2491 static const char __pyx_k_eps[] =
"eps";
2492 static const char __pyx_k_gen[] =
"gen";
2493 static const char __pyx_k_nan[] =
"nan";
2494 static const char __pyx_k_new[] =
"__new__";
2495 static const char __pyx_k_nnz[] =
"nnz";
2496 static const char __pyx_k_obj[] =
"obj";
2497 static const char __pyx_k_base[] =
"base";
2498 static const char __pyx_k_dict[] =
"__dict__";
2499 static const char __pyx_k_gram[] =
"gram";
2500 static const char __pyx_k_info[] =
"info";
2501 static const char __pyx_k_main[] =
"__main__";
2502 static const char __pyx_k_mode[] =
"mode";
2503 static const char __pyx_k_name[] =
"name";
2504 static const char __pyx_k_ndim[] =
"ndim";
2505 static const char __pyx_k_pack[] =
"pack";
2506 static const char __pyx_k_plot[] =
"plot";
2507 static const char __pyx_k_seed[] =
"seed";
2508 static const char __pyx_k_size[] =
"size";
2509 static const char __pyx_k_step[] =
"step";
2510 static const char __pyx_k_stop[] =
"stop";
2511 static const char __pyx_k_test[] =
"__test__";
2512 static const char __pyx_k_time[] =
"time";
2513 static const char __pyx_k_ASCII[] =
"ASCII";
2514 static const char __pyx_k_class[] =
"__class__";
2515 static const char __pyx_k_dtype[] =
"dtype";
2516 static const char __pyx_k_empty[] =
"empty";
2517 static const char __pyx_k_error[] =
"error";
2518 static const char __pyx_k_finfo[] =
"finfo";
2519 static const char __pyx_k_flags[] =
"flags";
2520 static const char __pyx_k_numpy[] =
"numpy";
2521 static const char __pyx_k_order[] =
"order";
2522 static const char __pyx_k_range[] =
"range";
2523 static const char __pyx_k_scipy[] =
"scipy";
2524 static const char __pyx_k_shape[] =
"shape";
2525 static const char __pyx_k_start[] =
"start";
2526 static const char __pyx_k_trace[] =
"trace";
2527 static const char __pyx_k_zeros[] =
"zeros";
2528 static const char __pyx_k_AinvpE[] =
"AinvpE";
2529 static const char __pyx_k_device[] =
"device";
2530 static const char __pyx_k_encode[] =
"encode";
2531 static const char __pyx_k_format[] =
"format";
2532 static const char __pyx_k_import[] =
"__import__";
2533 static const char __pyx_k_matmul[] =
"__matmul__";
2534 static const char __pyx_k_matrix[] =
"matrix";
2535 static const char __pyx_k_method[] =
"method";
2536 static const char __pyx_k_name_2[] =
"__name__";
2537 static const char __pyx_k_pickle[] =
"pickle";
2538 static const char __pyx_k_reduce[] =
"__reduce__";
2539 static const char __pyx_k_solver[] =
"solver";
2540 static const char __pyx_k_sparse[] =
"sparse";
2541 static const char __pyx_k_square[] =
"square";
2542 static const char __pyx_k_struct[] =
"struct";
2543 static const char __pyx_k_unpack[] =
"unpack";
2544 static const char __pyx_k_update[] =
"update";
2545 static const char __pyx_k_density[] =
"density";
2546 static const char __pyx_k_float32[] =
"float32";
2547 static const char __pyx_k_float64[] =
"float64";
2548 static const char __pyx_k_fortran[] =
"fortran";
2549 static const char __pyx_k_get_nnz[] =
"get_nnz";
2550 static const char __pyx_k_imatmul[] =
"__imatmul__";
2551 static const char __pyx_k_memview[] =
"memview";
2552 static const char __pyx_k_rmatmul[] =
"__rmatmul__";
2553 static const char __pyx_k_samples[] =
"samples";
2554 static const char __pyx_k_verbose[] =
"verbose";
2555 static const char __pyx_k_version[] =
"version";
2556 static const char __pyx_k_Ellipsis[] =
"Ellipsis";
2557 static const char __pyx_k_exponent[] =
"exponent";
2558 static const char __pyx_k_getstate[] =
"__getstate__";
2559 static const char __pyx_k_itemsize[] =
"itemsize";
2560 static const char __pyx_k_pyx_type[] =
"__pyx_type";
2561 static const char __pyx_k_setstate[] =
"__setstate__";
2562 static const char __pyx_k_TypeError[] =
"TypeError";
2563 static const char __pyx_k_converged[] =
"converged";
2564 static const char __pyx_k_cpu_count[] =
"cpu_count";
2565 static const char __pyx_k_data_type[] =
"data_type";
2566 static const char __pyx_k_enumerate[] =
"enumerate";
2567 static const char __pyx_k_pyx_state[] =
"__pyx_state";
2568 static const char __pyx_k_reduce_ex[] =
"__reduce_ex__";
2569 static const char __pyx_k_version_2[] =
"__version__";
2570 static const char __pyx_k_IndexError[] =
"IndexError";
2571 static const char __pyx_k_ValueError[] =
"ValueError";
2572 static const char __pyx_k_error_atol[] =
"error_atol";
2573 static const char __pyx_k_error_rtol[] =
"error_rtol";
2574 static const char __pyx_k_hutchinson[] =
"hutchinson";
2575 static const char __pyx_k_isspmatrix[] =
"isspmatrix";
2576 static const char __pyx_k_pyx_result[] =
"__pyx_result";
2577 static const char __pyx_k_pyx_vtable[] =
"__pyx_vtable__";
2578 static const char __pyx_k_solver_tol[] =
"solver_tol";
2579 static const char __pyx_k_MemoryError[] =
"MemoryError";
2580 static const char __pyx_k_PickleError[] =
"PickleError";
2581 static const char __pyx_k_convergence[] =
"convergence";
2582 static const char __pyx_k_get_density[] =
"get_density";
2583 static const char __pyx_k_num_threads[] =
"num_threads";
2584 static const char __pyx_k_return_info[] =
"return_info";
2585 static const char __pyx_k_vector_size[] =
"vector_size";
2586 static const char __pyx_k_RuntimeError[] =
"RuntimeError";
2587 static const char __pyx_k_memoryview_E[] =
"memoryview_E";
2588 static const char __pyx_k_num_outliers[] =
"num_outliers";
2589 static const char __pyx_k_operator_dot[] =
"_operator_dot";
2590 static const char __pyx_k_perf_counter[] =
"perf_counter";
2591 static const char __pyx_k_process_time[] =
"process_time";
2592 static const char __pyx_k_pyx_checksum[] =
"__pyx_checksum";
2593 static const char __pyx_k_samples_mean[] =
"samples_mean";
2594 static const char __pyx_k_scipy_sparse[] =
"scipy.sparse";
2595 static const char __pyx_k_stringsource[] =
"stringsource";
2596 static const char __pyx_k_alg_wall_time[] =
"alg_wall_time";
2597 static const char __pyx_k_assume_matrix[] =
"assume_matrix";
2598 static const char __pyx_k_cpu_proc_time[] =
"cpu_proc_time";
2599 static const char __pyx_k_linear_solver[] =
"linear_solver";
2600 static const char __pyx_k_num_inquiries[] =
"num_inquiries";
2601 static const char __pyx_k_orthogonalize[] =
"orthogonalize";
2602 static const char __pyx_k_print_summary[] =
"print_summary";
2603 static const char __pyx_k_pyx_getbuffer[] =
"__pyx_getbuffer";
2604 static const char __pyx_k_reduce_cython[] =
"__reduce_cython__";
2605 static const char __pyx_k_tot_wall_time[] =
"tot_wall_time";
2606 static const char __pyx_k_absolute_error[] =
"absolute_error";
2607 static const char __pyx_k_data_type_name[] =
"data_type_name";
2608 static const char __pyx_k_linear_algebra[] =
"_linear_algebra";
2609 static const char __pyx_k_relative_error[] =
"relative_error";
2610 static const char __pyx_k_View_MemoryView[] =
"View.MemoryView";
2611 static const char __pyx_k_allocate_buffer[] =
"allocate_buffer";
2612 static const char __pyx_k_check_arguments[] =
"check_arguments";
2613 static const char __pyx_k_dtype_is_object[] =
"dtype_is_object";
2614 static const char __pyx_k_max_num_samples[] =
"max_num_samples";
2615 static const char __pyx_k_min_num_samples[] =
"min_num_samples";
2616 static const char __pyx_k_multiprocessing[] =
"multiprocessing";
2617 static const char __pyx_k_num_cpu_threads[] =
"num_cpu_threads";
2618 static const char __pyx_k_num_gpu_devices[] =
"num_gpu_devices";
2619 static const char __pyx_k_pyx_PickleError[] =
"__pyx_PickleError";
2620 static const char __pyx_k_setstate_cython[] =
"__setstate_cython__";
2621 static const char __pyx_k_confidence_level[] =
"confidence_level";
2622 static const char __pyx_k_num_samples_used[] =
"num_samples_used";
2623 static const char __pyx_k_plot_convergence[] =
"plot_convergence";
2624 static const char __pyx_k_average_estimates[] =
"average_estimates";
2625 static const char __pyx_k_check_convergence[] =
"check_convergence";
2626 static const char __pyx_k_convergence_tools[] =
"_convergence_tools";
2627 static const char __pyx_k_hutchinson_method[] =
"hutchinson_method";
2628 static const char __pyx_k_pyx_unpickle_Enum[] =
"__pyx_unpickle_Enum";
2629 static const char __pyx_k_AtA_cannot_be_None[] =
"\"AtA\" cannot be None.";
2630 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
2631 static const char __pyx_k_get_data_type_name[] =
"get_data_type_name";
2632 static const char __pyx_k_init_alg_wall_time[] =
"init_alg_wall_time";
2633 static const char __pyx_k_init_cpu_proc_time[] =
"init_cpu_proc_time";
2634 static const char __pyx_k_init_tot_wall_time[] =
"init_tot_wall_time";
2635 static const char __pyx_k_strided_and_direct[] =
"<strided and direct>";
2636 static const char __pyx_k_strided_and_indirect[] =
"<strided and indirect>";
2637 static const char __pyx_k_contiguous_and_direct[] =
"<contiguous and direct>";
2638 static const char __pyx_k_num_processed_samples[] =
"num_processed_samples";
2639 static const char __pyx_k_MemoryView_of_r_object[] =
"<MemoryView of %r object>";
2640 static const char __pyx_k_MemoryView_of_r_at_0x_x[] =
"<MemoryView of %r at 0x%x>";
2641 static const char __pyx_k_contiguous_and_indirect[] =
"<contiguous and indirect>";
2642 static const char __pyx_k_hutchinson_method_float[] =
"_hutchinson_method_float";
2643 static const char __pyx_k_num_gpu_multiprocessors[] =
"num_gpu_multiprocessors";
2644 static const char __pyx_k_samples_processed_order[] =
"samples_processed_order";
2645 static const char __pyx_k_Cannot_index_with_type_s[] =
"Cannot index with type '%s'";
2646 static const char __pyx_k_hutchinson_method_double[] =
"_hutchinson_method_double";
2647 static const char __pyx_k_Invalid_shape_in_axis_d_d[] =
"Invalid shape in axis %d: %d.";
2648 static const char __pyx_k_hutchinson_method_line_37[] =
"hutchinson_method (line 37)";
2649 static const char __pyx_k_processed_samples_indices[] =
"processed_samples_indices";
2650 static const char __pyx_k_outlier_significance_level[] =
"outlier_significance_level";
2651 static const char __pyx_k_hutchinson_method_utilities[] =
"_hutchinson_method_utilities";
2652 static const char __pyx_k_itemsize_0_for_cython_array[] =
"itemsize <= 0 for cython.array";
2653 static const char __pyx_k_unable_to_allocate_array_data[] =
"unable to allocate array data.";
2654 static const char __pyx_k_strided_and_direct_or_indirect[] =
"<strided and direct or indirect>";
2655 static const char __pyx_k_Trace_of_matrix_or_linear_opera[] =
"\n Trace of matrix or linear operator using stochastic Lanczos quadrature\n method.\n\n If `C` is `None`, given the matrices :math:`\\mathbf{A}` and\n :math:`\\mathbf{B}` and the integer exponent :math:`p`, the following is\n computed:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B} \\mathbf{A}^{-p} \\right).\n\n If `B` is `None`, it is assumed that :math:`\\mathbf{B}` is the identity\n matrix.\n\n If `C` is not `None`, given the matrix :math:`\\mathbf{C}`, the following\n is instead computed:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B} \\mathbf{A}^{-p} \\mathbf{C}\n \\mathbf{A}^{-p} \\right).\n\n If ``gram`` is `True`, then :math:`\\mathbf{A}` in the above is replaced by\n the Gramian matrix :math:`\\mathbf{A}^{\\intercal} \\mathbf{A}`. Namely, if\n `C` is `None`:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\right),\n\n and if `C` is not `None`,\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\mathbf{C}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\right).\n\n Parameters\n ----------\n\n A : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. If ``gram`` is `True`, the matrix can be\n non-square.\n\n .. note::\n\n In the Hutchinson method, the matrix cannot be a type of\n :class:`Matrix` or :class:`imate.AffineMatrixFunction` classes.\n\n gram : bool, default=False\n If `True`, the trace of the Gramian matrix,\n :math:`(\\mathbf{A}^{\\intercal}\\mathbf{A})^p`, is computed. The\n Gramian matrix itself is not directly computed. If `False`, the\n trace of :math:`\\mathbf{A}^p` is computed.\n\n p : float, default=1.0\n The integer exponent :math:`p` in :math:`\\mathbf{A}^{-p}`.\n\n return_info : bool, default=False\n If `True`, this functio""n also returns a dictionary containing\n information about the inner computation, such as process time,\n algorithm settings, etc.\n\n B : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. `B` should be the same size and type of `A`.\n if `B` is `None`, it is assumed that `B` is the identity matrix.\n\n C : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. `C` should be the same size and type of `A`.\n\n assume_matrix : str {'gen', 'sym', 'pos', 'sym_pos'}, default: 'gen'\n Type of matrix `A`:\n\n * ``gen`` assumes `A` is a generic matrix.\n * ``sym`` assumes `A` is symmetric.\n * ``pos`` assumes `A` is positive-definite.\n * ``sym_pos`` assumes `A` is symmetric and positive-definite.\n\n min_num_samples : int, default=10\n The minimum number of Monte-Carlo samples. If the convergence criterion\n is reached before finishing the minimum number of iterations, the\n iterations are forced to continue till the minimum number of iterations\n is finished. This value should be smaller than\n ``maximum_num_samples``.\n\n max_num_samples : int, default=50\n The maximum number of Monte-Carlo samples. If the convergence criterion\n is not reached by the maximum number of iterations, the iterations are\n forced to stop. This value should be larger than\n ``minimum_num_samples``.\n\n error_atol : float, default=None\n Tolerance of the absolute error of convergence of the output. Once the\n error of convergence reaches ``error_atol + error_rtol * output``, the\n iteration is terminated. If the convergence criterion is not met by the\n tolerance, then the iterations continue till reaching\n ``max_num_samples`` iterations. If `None`, the termination criterion\n does not depend on this parameter.\n\n error_rtol : float, default=None\n Tolerance of the relative error of con""vergence of the output. Once the\n error of convergence reaches ``error_atol + error_rtol * output``, the\n iteration is terminated. If the convergence criterion is not met by the\n tolerance, then the iterations continue till reaching\n ``max_num_samples`` iterations. If `None`, the termination criterion\n does not depend on this parameter.\n\n confidence_level : float, default=0.95\n Confidence level of error, which is a number between `0` and `1`. The\n error of convergence of the population of samples is defined by their\n standard deviation times the Z-score, which depends on the confidence\n level. See notes below for details.\n\n outlier_significance_level : float, default=0.001\n One minus the confidence level of the uncertainty of the outliers of\n the output samples. This is a number between `0` and `1`.\n\n solver_tol : float, default=1e-6\n Tolerance of solving linear system.\n\n orthogonalize : int, default=0\n If `True`, it orthogonalizes the set of random vectors used for\n Monte-Carlo sampling. This might lead to a better estimation of the\n output.\n\n seed : int, default=None\n A non-negative integer to be used as seed to initiate the generation of\n sequences of peudo-random numbers in the algorithm. This is useful to\n make the result of the randomized algorithm to be reproducible. If\n ``None`` or a negative integer is given, the given seed value is\n ignored and the current processor time is used as the seed to initiate\n he generation random number sequences. In this case, the result is not\n reproducible, rather, is pseudo-random.\n\n num_threads : int, default=0\n Number of processor threads to employ for parallel computation on CPU.\n If set to `0` or a number larger than the available number of threads,\n all threads of the processor are used. The p""arallelization is performed\n over the Monte-Carlo iterations.\n\n verbose : bool, default=False\n Prints extra information about the computations.\n\n plot : bool, default=False\n Plots convergence of samples. To this end, `matplotlib` package should\n be installed. If no display is available (such as running this code on\n remote machines), the plots are saved as an `SVG` file in the current\n directory.\n\n Returns\n -------\n\n traceinv : float or numpy.array\n Trace of inverse of matrix.\n\n info : dict\n (Only if ``return_info`` is `True`) A dictionary of information with\n the following.\n\n * ``matrix``:\n * ``data_type``: `str`, {`float32`, `float64`, `float128`}. Type of\n the matrix data.\n * ``gram``: `bool`, whether the matrix `A` or its Gramian is\n considered.\n * ``exponent``: `float`, the exponent `p` in :math:`\\mathbf{A}^p`.\n * ``assume_matrix``: `str`, {`gen`, `sym`, `pos`, `sym_pos`},\n determines the type of matrix `A`.\n * ``size``: (int, int) The size of matrix `A`.\n * ``sparse``: `bool`, whether the matrix `A` is sparse or dense.\n * ``nnz``: `int`, if `A` is sparse, the number of non-zero elements\n of `A`.\n * ``density``: `float`, if `A` is sparse, the density of `A`, which\n is the `nnz` divided by size squared.\n * ``num_inquiries``: `int`, the size of inquiries of each parameter\n of the linear operator `A`. If `A` is a matrix, this is always\n `1`. If `A` is a type of :class:`AffineMatrixFunction`, this\n value is the number of :math:`t_i` parameters.\n\n * ``convergence``:\n * ``converged``: `bool`, whether the Monte-Carlo sampling\n converged.\n * ``min_num_samples``: `int`, the minimum number of Monte-C""arlo\n iterations.\n * ``max_num_samples``: `int`, the maximum number of Monte-Carlo\n iterations.\n * ``num_outliers``: `int`, number of outliers found during search\n for outliers among the array of output.\n * ``num_samples_used``: `int`, number of Monte-Carlo samples used\n to produce the output. This is the total number of iterations\n minus the number of outliers.\n * ``samples``: `array` [`float`], an array of the size\n `max_num_samples`. The first few entries (`num_samples_used`) of\n this array are the output results of the Monte-Carlo sampling.\n The average of these samples is the final result. The rest of\n this array is `nan`.\n * ``samples_mean``: `float`, mean of the `samples` array, excluding\n the `nan` values.\n * ``samples_processed_order``: `array` [`int`], in parallel\n processing, samples are processed in non-sequential order. This\n array, which has the same size as `samples`, keeps track of the\n order in which each sample is processed.\n\n * ``error``:\n * ``absolute_error``: `float`, the absolute error of the\n convergence of samples.\n * ``confidence_level``: `float`, the confidence level used to\n calculate the error from standard deviation of samples.\n * ``error_atol``: `float`, the tolerance of absolute error of the\n convergence of samples.\n * ``error_rtol``: `float`, the tolerance of relative error of the\n convergence of samples.\n * ``outlier_significance_level``: `float`, the significance level\n used to determine the outliers in samples.\n * ``relative_error``: `float`, the relative error of the\n convergence of samples.\n\n * ``device``:""\n * ``num_cpu_threads``: `int`, number of CPU threads used in shared\n memory parallel processing.\n * ``num_gpu_devices``: `int`, number of GPU devices used in the\n multi-GPU (GPU farm) computation.\n * ``num_gpu_multiprocessors``: `int`, number of GPU\n multi-processors.\n * ``num_gpu_threads_per_multiprocessor``: `int`, number of GPU\n threads on each GPU multi-processor.\n\n * ``time``:\n * ``tot_wall_time``: `float`, total elapsed time of computation.\n * ``alg_wall_time``: `float`, elapsed time of computation during\n only the algorithm execution.\n * ``cpu_proc_time``: `float`, the CPU processing time of\n computation.\n\n * ``solver``:\n * ``version``: `str`, version of imate.\n * ``method``: 'hutchinson'.\n * ``solver_tol``: `float`, tolerance of solving linear system.\n * ``orthogonalize``: `bool`, orthogonalization flag.\n * ``seed`` : `int`, seed value for random number generation.\n\n Raises\n ------\n\n ImportError\n If the package has not been compiled with GPU support, but ``gpu`` is\n set to `True`. To resolve the issue, set ``gpu`` to `False` to be able\n to use the existing installation. Alternatively, export the\n environment variable ``USE_CUDA=1`` and recompile the source code of\n the package.\n\n See Also\n --------\n\n imate.logdet\n imate.trace\n imate.schatten\n\n Notes\n -----\n\n **Computational Complexity:**\n\n This method uses the Hutchinson, which is a randomized algorithm. The\n computational complexity of this method is\n\n .. math::\n\n \\mathcal{O}((\\rho n^2s),\n\n where :math:`n` is the matrix size, :math:`\\rho` is the density of\n sparse matrix (for dense matrix, :math:`\\rho=1`), and :math:`s` is the\n number o""f samples (set with ``min_num_samples`` and ``max_num_samples``).\n\n This method can be used on very large matrices (:math:`n > 2^{12}`). The\n solution is an approximation.\n\n **Convergence criterion:**\n\n Let :math:`n_{\\min}` and :math:`n_{\\max}` be the minimum and maximum\n number of iterations respectively defined by ``min_num_samples`` and\n ``max_num_samples``. The iterations terminate at\n :math:`n_{\\min} \\leq i \\leq n_{\\max}` where :math:`i` is the\n iteration counter. The iterations stop earlier at :math:`i < n_{\\max}` if\n the convergence error of the mean of the samples is satisfied, as follows.\n\n Suppose :math:`s(j)` and :math:`\\sigma(i)` are respectively the mean and\n standard deviation of samples after :math:`j` iterations. The error of\n convergence, :math:`e(j)`, is defined by\n\n .. math::\n\n e(j) = \\frac{\\sigma(j)}{\\sqrt{j}} Z\n\n where :math:`Z` is the Z-score defined by\n\n .. math::\n\n Z = \\sqrt{2} \\mathrm{erf}^{-1}(\\phi).\n\n In the above, :math:`\\phi` is the confidence level and set by\n ``confidence_level`` argument, and :math:`\\mathrm{erf}^{-1}` is the\n inverse error function. A confidence level of 95%, for instance, means that\n the Z-score is 1.96, which means the confidence interval is\n :math:`\\pm 1.96 \\sigma`.\n\n The termination criterion is\n\n .. math::\n\n e(j) < \\epsilon_a + s(j) \\epsilon_r,\n\n where :math:`\\epsilon_{a}` and :math:`\\epsilon_r` are the absolute and\n relative error tolerances respectively, and they are set by ``error_atol``\n and ``error_rtol``.\n\n **Plotting:**\n\n If ``plot`` is set to `True`, it plots the convergence of samples and their\n relative error.\n\n * If no graphical backend exists (such as running the code on a remote\n server or manually disabling the X11 backend), the plot will not be\n shown, rather, it will be saved as an ``svg`` file in the current""\n directory.\n * If the executable ``latex`` is available on ``PATH``, the plot is\n rendered using :math:`\\rm\\LaTeX` and it may take slightly longer to\n produce the plot.\n * If :math:`\\rm\\LaTeX` is not installed, it uses any available San-Serif\n font to render the plot.\n\n To manually disable interactive plot display and save the plot as\n ``svg`` instead, add the following at the very beginning of your code\n before importing :mod:`imate`:\n\n .. code-block:: python\n\n >>> import os\n >>> os.environ['IMATE_NO_DISPLAY'] = 'True'\n\n References\n ----------\n\n * `Ubaru, S., Chen, J., and Saad, Y. (2017)\n <https://www-users.cs.umn.edu/~saad/PDF/ys-2016-04.pdf>`_,\n Fast Estimation of :math:`\\mathrm{tr}(F(A))` Via Stochastic Lanczos\n Quadrature, SIAM J. Matrix Anal. Appl., 38(4), 1075-1099.\n\n Examples\n --------\n\n **Basic Usage:**\n\n Compute the trace of :math:`\\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Import packages\n >>> from imate import toeplitz, traceinv\n\n >>> # Generate a sample matrix\n >>> A = toeplitz(2, 1, size=100)\n\n >>> # Compute trace of inverse\n >>> traceinv(A, p=2, method='hutchinson')\n 24.73726368966402\n\n Compute the trace of :math:`(\\mathbf{A}^{\\intercal} \\mathbf{A})^{-2}`:\n\n .. code-block:: python\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, gram=True, p=2, method='hutchinson')\n 17.751659383784748\n\n Compute the trace of :math:`\\mathbf{B} \\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Generate another sample matrix\n >>> B = toeplitz(4, 3, size=100)\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, p=2, method='hutchinson', B=B)\n 99.8817360381704\n\n Compute the trace of :math:`\\mathbf{B} \\mathbf{A}^{-2} \\mathbf{C}\n \\mathbf{A}^{-2}`:\n\n .. code-block:: python""\n\n >>> # Generate another sample matrix\n >>> C = toeplitz(5, 4, size=100)\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, p=2, method='hutchinson', B=B, C=C)\n 124.45436379980006\n\n Compute the trace of :math:`\\mathbf{B} (\\mathbf{A}^{\\intercal}\n \\mathbf{A})^{-2} \\mathbf{C} (\\mathbf{A}^{\\intercal} \\mathbf{A})^{-2}`:\n\n .. code-block:: python\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, gram=True, p=2, method='hutchinson', B=B, C=C)\n 5.517453125230929\n\n **Verbose output:**\n\n By setting ``verbose`` to `True`, useful info about the process is\n printed.\n\n .. literalinclude:: ../_static/data/imate.traceinv.hutchinson-verbose.txt\n :language: python\n\n **Output information:**\n\n Print information about the inner computation:\n\n .. code-block:: python\n\n >>> ti, info = traceinv(A, method='hutchinson', return_info=True)\n >>> print(ti)\n 50.059307947603585\n\n >>> # Print dictionary neatly using pprint\n >>> from pprint import pprint\n >>> pprint(info)\n {\n 'matrix': {\n 'assume_matrix': 'gen',\n 'data_type': b'float64',\n 'density': 0.0199,\n 'exponent': 1,\n 'gram': False,\n 'nnz': 199,\n 'num_inquiries': 1,\n 'size': (100, 100),\n 'sparse': True\n },\n 'convergence': {\n 'converged': False,\n 'max_num_samples': 50,\n 'min_num_samples': 10,\n 'num_outliers': 0,\n 'num_samples_used': 50,\n 'samples': array([52.237154, ..., 51.37932704]),\n 'samples_mean': 50.059307947603585,\n 'samples_processed_order': array([ 0, ..., 49])\n },\n 'error': {\n 'absolute_error': 0.8111""131801161796,\n 'confidence_level': 0.95,\n 'error_atol': 0.0,\n 'error_rtol': 0.01,\n 'outlier_significance_level': 0.001,\n 'relative_error': 0.016203044216375525\n },\n 'solver': {\n 'method': 'hutchinson',\n 'orthogonalize': True,\n 'seed': None,\n 'solver_tol': 1e-06,\n 'version': '0.16.0'\n },\n 'device': {\n 'num_cpu_threads': 8,\n 'num_gpu_devices': 0,\n 'num_gpu_multiprocessors': 0,\n 'num_gpu_threads_per_multiprocessor': 0\n },\n 'time': {\n 'alg_wall_time': 0.03236744087189436,\n 'cpu_proc_time': 0.047695197999999994,\n 'tot_wall_time': 0.033352302853018045\n }\n }\n\n **Large matrix:**\n\n Compute the trace of :math:`\\mathbf{A}^{-1}` for a very large sparse\n matrix using at least `100` samples.\n\n .. code-block:: python\n :emphasize-lines: 5, 6, 7\n\n >>> # Create a symmetric positive-definite matrix of size one million.\n >>> A = toeplitz(2, 1, size=1000000, gram=True)\n\n >>> # Approximate trace using hutchinson method\n >>> ti, info = traceinv(A, method='hutchinson', solver_tol=1e-4,\n ... assume_matrix='sym_pos', min_num_samples=100,\n ... max_num_samples=200, return_info=True)\n >>> print(ti)\n 333292.3226031165\n\n >>> # Find the time it took to compute the above\n >>> print(info['time'])\n {\n 'tot_wall_time': 175.93423152901232,\n 'alg_wall_time': 119.86316476506181,\n 'cpu_proc_time': 572.180877451\n }\n\n Compare the result of the above approximation with the exact solution of\n the trace using the analytic relation for Toeplitz matrix. Se""e\n :func:`imate.sample_matrices.toeplitz_traceinv` for details.\n\n .. code-block:: python\n\n >>> from imate.sample_matrices import toeplitz_traceinv\n >>> toeplitz_traceinv(2, 1, size=1000000, gram=True)\n 333333.2222222222\n\n It can be seen that the error of approximation is :math:`0.012 \\%`. This\n accuracy is remarkable considering that the computation on such a large\n matrix took on 119 seconds. Computing the trace of such a large matrix\n using any of the exact methods (such as ``exact`` or ``eigenvalue``) is\n infeasible.\n\n **Plotting:**\n\n By setting ``plot`` to `True`, plots of samples during Monte-Carlo\n iterations and the convergence of their mean are generated.\n\n .. code-block:: python\n\n >>> A = toeplitz(2, 1, size=1000000, gram=True)\n >>> traceinv(A, method='hutchinson', assume_matrix='sym_pos',\n ... solver_tol=1e-4, min_num_samples=50, max_num_samples=150,\n ... error_rtol=2e-4, confidence_level=0.95,\n ... outlier_significance_level=0.001, plot=True)\n\n .. image:: ../_static/images/plots/traceinv_hutchinson_convergence.png\n :align: center\n :class: custom-dark\n\n In the left plot, the samples are shown in circles and the cumulative mean\n of the samples is shown by a solid black curve. The shaded area corresponds\n to the 95% confidence interval :math:`\\pm 1.96 \\sigma`, which is set by\n ``confidence_level=0.95``. The samples outside the interval of 99.9% are\n considered outliers, which is set by the significance level\n ``outlier_significance_level=0.001``.\n\n In the right plot, the darker shaded area in the interval :math:`[0, 50]`\n shows the minimum number of samples and is set by ``min_num_samples=50``.\n The iterations do not stop till the minimum number of iterations is passed.\n We can observe that sampling is terminated after 140 iterations where the\n relat""ive error of samples reaches 0.02% since we set ``error_rtol=2e-4``.\n The lighter shaded area in the interval :math:`[140, 150]` corresponds to\n the iterations that were not performed to reach the specified maximum\n iterations by ``max_num_samples=150``.\n ";
2656 static const char __pyx_k_linear_algebra_matrix_utilities[] =
"_linear_algebra.matrix_utilities";
2657 static const char __pyx_k_trace_estimator_trace_estimator[] =
"_trace_estimator.trace_estimator_plot_utilities";
2658 static const char __pyx_k_Buffer_view_does_not_expose_stri[] =
"Buffer view does not expose strides";
2659 static const char __pyx_k_Can_only_create_a_buffer_that_is[] =
"Can only create a buffer that is contiguous in memory.";
2660 static const char __pyx_k_Cannot_assign_to_read_only_memor[] =
"Cannot assign to read-only memoryview";
2661 static const char __pyx_k_Cannot_create_writable_memory_vi[] =
"Cannot create writable memory view from read-only memoryview";
2662 static const char __pyx_k_Data_type_should_be_either_float[] =
"Data type should be either \"float32\" or \"float64\"";
2663 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] =
"Empty shape tuple for cython.array";
2664 static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] =
"Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))";
2665 static const char __pyx_k_Indirect_dimensions_not_supporte[] =
"Indirect dimensions not supported";
2666 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] =
"Invalid mode, expected 'c' or 'fortran', got %s";
2667 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] =
"Out of bounds on buffer access (axis %d)";
2668 static const char __pyx_k_Unable_to_convert_item_to_object[] =
"Unable to convert item to object";
2669 static const char __pyx_k_got_differing_extents_in_dimensi[] =
"got differing extents in dimension %d (got %d and %d)";
2670 static const char __pyx_k_imate_traceinv__hutchinson_metho[] =
"imate/traceinv/_hutchinson_method.pyx";
2671 static const char __pyx_k_no_default___reduce___due_to_non[] =
"no default __reduce__ due to non-trivial __cinit__";
2672 static const char __pyx_k_num_gpu_threads_per_multiprocess[] =
"num_gpu_threads_per_multiprocessor";
2673 static const char __pyx_k_unable_to_allocate_shape_and_str[] =
"unable to allocate shape and strides.";
2674 static const char __pyx_k_imate_traceinv__hutchinson_metho_2[] =
"imate.traceinv._hutchinson_method";
2675 static PyObject *__pyx_n_s_A;
2676 static PyObject *__pyx_n_s_ASCII;
2677 static PyObject *__pyx_n_s_AinvpE;
2678 static PyObject *__pyx_n_s_AtA;
2679 static PyObject *__pyx_kp_u_AtA_cannot_be_None;
2680 static PyObject *__pyx_n_s_B;
2681 static PyObject *__pyx_n_s_BE;
2682 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2683 static PyObject *__pyx_n_s_C;
2684 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2685 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2686 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2687 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2688 static PyObject *__pyx_kp_u_Data_type_should_be_either_float;
2689 static PyObject *__pyx_n_s_E;
2690 static PyObject *__pyx_n_s_Ellipsis;
2691 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2692 static PyObject *__pyx_n_u_F;
2693 static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0;
2694 static PyObject *__pyx_n_s_IndexError;
2695 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2696 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2697 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2698 static PyObject *__pyx_n_s_MemoryError;
2699 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2700 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2701 static PyObject *__pyx_n_b_O;
2702 static PyObject *__pyx_n_s_OpE;
2703 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2704 static PyObject *__pyx_n_s_PickleError;
2705 static PyObject *__pyx_n_s_RuntimeError;
2706 static PyObject *__pyx_n_s_T;
2707 static PyObject *__pyx_kp_u_Trace_of_matrix_or_linear_opera;
2708 static PyObject *__pyx_n_s_TypeError;
2709 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2710 static PyObject *__pyx_n_s_ValueError;
2711 static PyObject *__pyx_n_s_View_MemoryView;
2712 static PyObject *__pyx_n_s_abs;
2713 static PyObject *__pyx_n_u_absolute_error;
2714 static PyObject *__pyx_n_s_alg_wall_time;
2715 static PyObject *__pyx_n_u_alg_wall_time;
2716 static PyObject *__pyx_n_s_allocate_buffer;
2717 static PyObject *__pyx_n_s_assume_matrix;
2718 static PyObject *__pyx_n_u_assume_matrix;
2719 static PyObject *__pyx_n_s_average_estimates;
2720 static PyObject *__pyx_n_s_base;
2721 static PyObject *__pyx_n_s_c;
2722 static PyObject *__pyx_n_u_c;
2723 static PyObject *__pyx_n_s_cE;
2724 static PyObject *__pyx_n_s_check_arguments;
2725 static PyObject *__pyx_n_s_check_convergence;
2726 static PyObject *__pyx_n_s_class;
2727 static PyObject *__pyx_n_s_cline_in_traceback;
2728 static PyObject *__pyx_n_s_confidence_level;
2729 static PyObject *__pyx_n_u_confidence_level;
2730 static PyObject *__pyx_kp_s_contiguous_and_direct;
2731 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2732 static PyObject *__pyx_n_s_converged;
2733 static PyObject *__pyx_n_u_converged;
2734 static PyObject *__pyx_n_u_convergence;
2735 static PyObject *__pyx_n_s_convergence_tools;
2736 static PyObject *__pyx_n_s_cpu_count;
2737 static PyObject *__pyx_n_s_cpu_proc_time;
2738 static PyObject *__pyx_n_u_cpu_proc_time;
2739 static PyObject *__pyx_n_u_data_type;
2740 static PyObject *__pyx_n_s_data_type_name;
2741 static PyObject *__pyx_n_u_density;
2742 static PyObject *__pyx_n_u_device;
2743 static PyObject *__pyx_n_s_dict;
2744 static PyObject *__pyx_n_s_dtype;
2745 static PyObject *__pyx_n_s_dtype_is_object;
2746 static PyObject *__pyx_n_s_empty;
2747 static PyObject *__pyx_n_s_encode;
2748 static PyObject *__pyx_n_s_enumerate;
2749 static PyObject *__pyx_n_s_eps;
2750 static PyObject *__pyx_n_s_error;
2751 static PyObject *__pyx_n_u_error;
2752 static PyObject *__pyx_n_s_error_atol;
2753 static PyObject *__pyx_n_u_error_atol;
2754 static PyObject *__pyx_n_s_error_rtol;
2755 static PyObject *__pyx_n_u_error_rtol;
2756 static PyObject *__pyx_n_u_exponent;
2757 static PyObject *__pyx_n_s_finfo;
2758 static PyObject *__pyx_n_s_flags;
2759 static PyObject *__pyx_n_b_float32;
2760 static PyObject *__pyx_n_s_float32;
2761 static PyObject *__pyx_n_b_float64;
2762 static PyObject *__pyx_n_s_float64;
2763 static PyObject *__pyx_n_s_format;
2764 static PyObject *__pyx_n_s_fortran;
2765 static PyObject *__pyx_n_u_fortran;
2766 static PyObject *__pyx_n_u_gen;
2767 static PyObject *__pyx_n_s_get_data_type_name;
2768 static PyObject *__pyx_n_s_get_density;
2769 static PyObject *__pyx_n_s_get_nnz;
2770 static PyObject *__pyx_n_s_getstate;
2771 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2772 static PyObject *__pyx_n_s_gram;
2773 static PyObject *__pyx_n_u_gram;
2774 static PyObject *__pyx_n_u_hutchinson;
2775 static PyObject *__pyx_n_s_hutchinson_method;
2776 static PyObject *__pyx_n_s_hutchinson_method_double;
2777 static PyObject *__pyx_n_s_hutchinson_method_float;
2778 static PyObject *__pyx_kp_u_hutchinson_method_line_37;
2779 static PyObject *__pyx_n_s_hutchinson_method_utilities;
2780 static PyObject *__pyx_n_s_i;
2781 static PyObject *__pyx_n_s_id;
2782 static PyObject *__pyx_kp_s_imate_traceinv__hutchinson_metho;
2783 static PyObject *__pyx_n_s_imate_traceinv__hutchinson_metho_2;
2784 static PyObject *__pyx_n_s_imatmul;
2785 static PyObject *__pyx_n_s_import;
2786 static PyObject *__pyx_n_s_info;
2787 static PyObject *__pyx_n_s_init_alg_wall_time;
2788 static PyObject *__pyx_n_s_init_cpu_proc_time;
2789 static PyObject *__pyx_n_s_init_tot_wall_time;
2790 static PyObject *__pyx_n_s_isspmatrix;
2791 static PyObject *__pyx_n_s_itemsize;
2792 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2793 static PyObject *__pyx_n_s_linear_algebra;
2794 static PyObject *__pyx_n_s_linear_algebra_matrix_utilities;
2795 static PyObject *__pyx_n_s_linear_solver;
2796 static PyObject *__pyx_n_s_main;
2797 static PyObject *__pyx_n_s_matmul;
2798 static PyObject *__pyx_n_u_matrix;
2799 static PyObject *__pyx_n_s_max_num_samples;
2800 static PyObject *__pyx_n_u_max_num_samples;
2801 static PyObject *__pyx_n_s_memoryview_E;
2802 static PyObject *__pyx_n_s_memview;
2803 static PyObject *__pyx_n_u_method;
2804 static PyObject *__pyx_n_s_min_num_samples;
2805 static PyObject *__pyx_n_u_min_num_samples;
2806 static PyObject *__pyx_n_s_mode;
2807 static PyObject *__pyx_n_s_multiprocessing;
2808 static PyObject *__pyx_n_s_name;
2809 static PyObject *__pyx_n_s_name_2;
2810 static PyObject *__pyx_n_s_nan;
2811 static PyObject *__pyx_n_s_ndim;
2812 static PyObject *__pyx_n_s_new;
2813 static PyObject *__pyx_n_u_nnz;
2814 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2815 static PyObject *__pyx_n_u_num_cpu_threads;
2816 static PyObject *__pyx_n_u_num_gpu_devices;
2817 static PyObject *__pyx_n_u_num_gpu_multiprocessors;
2818 static PyObject *__pyx_n_u_num_gpu_threads_per_multiprocess;
2819 static PyObject *__pyx_n_u_num_inquiries;
2820 static PyObject *__pyx_n_s_num_outliers;
2821 static PyObject *__pyx_n_u_num_outliers;
2822 static PyObject *__pyx_n_s_num_processed_samples;
2823 static PyObject *__pyx_n_s_num_samples_used;
2824 static PyObject *__pyx_n_u_num_samples_used;
2825 static PyObject *__pyx_n_s_num_threads;
2826 static PyObject *__pyx_n_s_numpy;
2827 static PyObject *__pyx_n_s_obj;
2828 static PyObject *__pyx_n_s_operator_dot;
2829 static PyObject *__pyx_n_s_order;
2830 static PyObject *__pyx_n_s_orthogonalize;
2831 static PyObject *__pyx_n_u_orthogonalize;
2832 static PyObject *__pyx_n_s_outlier_significance_level;
2833 static PyObject *__pyx_n_u_outlier_significance_level;
2834 static PyObject *__pyx_n_s_p;
2835 static PyObject *__pyx_n_s_pack;
2836 static PyObject *__pyx_n_s_perf_counter;
2837 static PyObject *__pyx_n_s_pickle;
2838 static PyObject *__pyx_n_s_plot;
2839 static PyObject *__pyx_n_s_plot_convergence;
2840 static PyObject *__pyx_n_s_print_summary;
2841 static PyObject *__pyx_n_s_process_time;
2842 static PyObject *__pyx_n_s_processed_samples_indices;
2843 static PyObject *__pyx_n_s_pyx_PickleError;
2844 static PyObject *__pyx_n_s_pyx_checksum;
2845 static PyObject *__pyx_n_s_pyx_getbuffer;
2846 static PyObject *__pyx_n_s_pyx_result;
2847 static PyObject *__pyx_n_s_pyx_state;
2848 static PyObject *__pyx_n_s_pyx_type;
2849 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2850 static PyObject *__pyx_n_s_pyx_vtable;
2851 static PyObject *__pyx_n_s_range;
2852 static PyObject *__pyx_n_s_reduce;
2853 static PyObject *__pyx_n_s_reduce_cython;
2854 static PyObject *__pyx_n_s_reduce_ex;
2855 static PyObject *__pyx_n_u_relative_error;
2856 static PyObject *__pyx_n_s_return_info;
2857 static PyObject *__pyx_n_s_rmatmul;
2858 static PyObject *__pyx_n_s_samples;
2859 static PyObject *__pyx_n_u_samples;
2860 static PyObject *__pyx_n_u_samples_mean;
2861 static PyObject *__pyx_n_u_samples_processed_order;
2862 static PyObject *__pyx_n_s_scipy;
2863 static PyObject *__pyx_n_s_scipy_sparse;
2864 static PyObject *__pyx_n_s_seed;
2865 static PyObject *__pyx_n_u_seed;
2866 static PyObject *__pyx_n_s_setstate;
2867 static PyObject *__pyx_n_s_setstate_cython;
2868 static PyObject *__pyx_n_s_shape;
2869 static PyObject *__pyx_n_s_size;
2870 static PyObject *__pyx_n_u_size;
2871 static PyObject *__pyx_n_u_solver;
2872 static PyObject *__pyx_n_s_solver_tol;
2873 static PyObject *__pyx_n_u_solver_tol;
2874 static PyObject *__pyx_n_u_sparse;
2875 static PyObject *__pyx_n_s_square;
2876 static PyObject *__pyx_n_s_start;
2877 static PyObject *__pyx_n_s_step;
2878 static PyObject *__pyx_n_s_stop;
2879 static PyObject *__pyx_kp_s_strided_and_direct;
2880 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2881 static PyObject *__pyx_kp_s_strided_and_indirect;
2882 static PyObject *__pyx_kp_s_stringsource;
2883 static PyObject *__pyx_n_s_struct;
2884 static PyObject *__pyx_n_s_test;
2885 static PyObject *__pyx_n_s_time;
2886 static PyObject *__pyx_n_u_time;
2887 static PyObject *__pyx_n_s_tot_wall_time;
2888 static PyObject *__pyx_n_u_tot_wall_time;
2889 static PyObject *__pyx_n_s_trace;
2890 static PyObject *__pyx_n_s_trace_estimator_trace_estimator;
2891 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2892 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2893 static PyObject *__pyx_n_s_unpack;
2894 static PyObject *__pyx_n_s_update;
2895 static PyObject *__pyx_n_s_vector_size;
2896 static PyObject *__pyx_n_s_verbose;
2897 static PyObject *__pyx_n_u_version;
2898 static PyObject *__pyx_n_s_version_2;
2899 static PyObject *__pyx_n_s_zeros;
2900 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_hutchinson_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_return_info, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_verbose, PyObject *__pyx_v_plot);
2901 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads);
2902 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads);
2903 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_6_operator_dot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_AtA, PyObject *__pyx_v_p, PyObject *__pyx_v_gram, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_B, PyObject *__pyx_v_E);
2904 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer);
2905 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2906 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self);
2907 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self);
2908 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self);
2909 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr);
2910 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item);
2911 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
2912 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self);
2913 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2914 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name);
2915 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2916 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2917 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state);
2918 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object);
2919 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self);
2920 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2921 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2922 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2923 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2924 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2925 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2926 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2927 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2928 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2929 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2930 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2931 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2932 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self);
2933 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self);
2934 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self);
2935 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2936 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2937 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self);
2938 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self);
2939 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self);
2940 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2941 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2942 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2943 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2944 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2945 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state);
2946 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k);
2947 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k);
2948 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k);
2949 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k);
2950 static PyObject *__pyx_float_0_95;
2951 static PyObject *__pyx_float_1eneg_2;
2952 static PyObject *__pyx_float_1eneg_6;
2953 static PyObject *__pyx_float_0_001;
2954 static PyObject *__pyx_int_0;
2955 static PyObject *__pyx_int_1;
2956 static PyObject *__pyx_int_10;
2957 static PyObject *__pyx_int_50;
2958 static PyObject *__pyx_int_112105877;
2959 static PyObject *__pyx_int_136983863;
2960 static PyObject *__pyx_int_184977713;
2961 static PyObject *__pyx_int_neg_1;
2962 static PyObject *__pyx_codeobj_;
2963 static PyObject *__pyx_slice__4;
2964 static PyObject *__pyx_tuple__2;
2965 static PyObject *__pyx_tuple__6;
2966 static PyObject *__pyx_tuple__8;
2967 static PyObject *__pyx_tuple__9;
2968 static PyObject *__pyx_tuple__10;
2969 static PyObject *__pyx_tuple__11;
2970 static PyObject *__pyx_tuple__12;
2971 static PyObject *__pyx_tuple__13;
2972 static PyObject *__pyx_tuple__14;
2973 static PyObject *__pyx_tuple__15;
2974 static PyObject *__pyx_tuple__16;
2975 static PyObject *__pyx_tuple__17;
2976 static PyObject *__pyx_tuple__18;
2977 static PyObject *__pyx_tuple__19;
2978 static PyObject *__pyx_tuple__20;
2979 static PyObject *__pyx_tuple__21;
2980 static PyObject *__pyx_tuple__22;
2981 static PyObject *__pyx_tuple__23;
2982 static PyObject *__pyx_tuple__24;
2983 static PyObject *__pyx_tuple__26;
2984 static PyObject *__pyx_tuple__27;
2985 static PyObject *__pyx_tuple__28;
2986 static PyObject *__pyx_tuple__29;
2987 static PyObject *__pyx_tuple__30;
2988 static PyObject *__pyx_tuple__31;
2989 static PyObject *__pyx_tuple__32;
2990 static PyObject *__pyx_tuple__33;
2991 static PyObject *__pyx_tuple__34;
2992 static PyObject *__pyx_tuple__35;
2993 static PyObject *__pyx_tuple__36;
2994 static PyObject *__pyx_tuple__37;
2995 static PyObject *__pyx_codeobj__3;
2996 static PyObject *__pyx_codeobj__5;
2997 static PyObject *__pyx_codeobj__7;
2998 static PyObject *__pyx_codeobj__25;
3010 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_1hutchinson_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3011 static char __pyx_doc_5imate_8traceinv_18_hutchinson_method_hutchinson_method[] =
"hutchinson_method(A, gram=False, p=1, return_info=False, B=None, C=None, assume_matrix=u'gen', min_num_samples=10, max_num_samples=50, error_atol=None, error_rtol=1e-2, confidence_level=0.95, outlier_significance_level=0.001, solver_tol=1e-6, orthogonalize=True, seed=None, num_threads=0, verbose=False, plot=False)\n\n Trace of matrix or linear operator using stochastic Lanczos quadrature\n method.\n\n If `C` is `None`, given the matrices :math:`\\mathbf{A}` and\n :math:`\\mathbf{B}` and the integer exponent :math:`p`, the following is\n computed:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B} \\mathbf{A}^{-p} \\right).\n\n If `B` is `None`, it is assumed that :math:`\\mathbf{B}` is the identity\n matrix.\n\n If `C` is not `None`, given the matrix :math:`\\mathbf{C}`, the following\n is instead computed:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B} \\mathbf{A}^{-p} \\mathbf{C}\n \\mathbf{A}^{-p} \\right).\n\n If ``gram`` is `True`, then :math:`\\mathbf{A}` in the above is replaced by\n the Gramian matrix :math:`\\mathbf{A}^{\\intercal} \\mathbf{A}`. Namely, if\n `C` is `None`:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\right),\n\n and if `C` is not `None`,\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\mathbf{C}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\right).\n\n Parameters\n ----------\n\n A : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. If ``gram`` is `True`, the matrix can be\n non-square.\n\n .. note::\n\n In the Hutchinson method, the matrix cannot be a type of\n :class:`Matrix` or :class:`imate.AffineMatrixFunction` classes.\n\n gram : bool, default=False\n If `True`, the trace of the Gramian matrix,\n :math:`(\\mathbf{A}^{\\intercal}\\mathbf{A})^p`"", is computed. The\n Gramian matrix itself is not directly computed. If `False`, the\n trace of :math:`\\mathbf{A}^p` is computed.\n\n p : float, default=1.0\n The integer exponent :math:`p` in :math:`\\mathbf{A}^{-p}`.\n\n return_info : bool, default=False\n If `True`, this function also returns a dictionary containing\n information about the inner computation, such as process time,\n algorithm settings, etc.\n\n B : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. `B` should be the same size and type of `A`.\n if `B` is `None`, it is assumed that `B` is the identity matrix.\n\n C : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. `C` should be the same size and type of `A`.\n\n assume_matrix : str {'gen', 'sym', 'pos', 'sym_pos'}, default: 'gen'\n Type of matrix `A`:\n\n * ``gen`` assumes `A` is a generic matrix.\n * ``sym`` assumes `A` is symmetric.\n * ``pos`` assumes `A` is positive-definite.\n * ``sym_pos`` assumes `A` is symmetric and positive-definite.\n\n min_num_samples : int, default=10\n The minimum number of Monte-Carlo samples. If the convergence criterion\n is reached before finishing the minimum number of iterations, the\n iterations are forced to continue till the minimum number of iterations\n is finished. This value should be smaller than\n ``maximum_num_samples``.\n\n max_num_samples : int, default=50\n The maximum number of Monte-Carlo samples. If the convergence criterion\n is not reached by the maximum number of iterations, the iterations are\n forced to stop. This value should be larger than\n ``minimum_num_samples``.\n\n error_atol : float, default=None\n Tolerance of the absolute error of convergence of the output. Once the\n error of convergence reaches ``error_atol + error_rtol * output``, the\n iteration is terminated. If"" the convergence criterion is not met by the\n tolerance, then the iterations continue till reaching\n ``max_num_samples`` iterations. If `None`, the termination criterion\n does not depend on this parameter.\n\n error_rtol : float, default=None\n Tolerance of the relative error of convergence of the output. Once the\n error of convergence reaches ``error_atol + error_rtol * output``, the\n iteration is terminated. If the convergence criterion is not met by the\n tolerance, then the iterations continue till reaching\n ``max_num_samples`` iterations. If `None`, the termination criterion\n does not depend on this parameter.\n\n confidence_level : float, default=0.95\n Confidence level of error, which is a number between `0` and `1`. The\n error of convergence of the population of samples is defined by their\n standard deviation times the Z-score, which depends on the confidence\n level. See notes below for details.\n\n outlier_significance_level : float, default=0.001\n One minus the confidence level of the uncertainty of the outliers of\n the output samples. This is a number between `0` and `1`.\n\n solver_tol : float, default=1e-6\n Tolerance of solving linear system.\n\n orthogonalize : int, default=0\n If `True`, it orthogonalizes the set of random vectors used for\n Monte-Carlo sampling. This might lead to a better estimation of the\n output.\n\n seed : int, default=None\n A non-negative integer to be used as seed to initiate the generation of\n sequences of peudo-random numbers in the algorithm. This is useful to\n make the result of the randomized algorithm to be reproducible. If\n ``None`` or a negative integer is given, the given seed value is\n ignored and the current processor time is used as the seed to initiate\n he generation random number sequences. In this case,"" the result is not\n reproducible, rather, is pseudo-random.\n\n num_threads : int, default=0\n Number of processor threads to employ for parallel computation on CPU.\n If set to `0` or a number larger than the available number of threads,\n all threads of the processor are used. The parallelization is performed\n over the Monte-Carlo iterations.\n\n verbose : bool, default=False\n Prints extra information about the computations.\n\n plot : bool, default=False\n Plots convergence of samples. To this end, `matplotlib` package should\n be installed. If no display is available (such as running this code on\n remote machines), the plots are saved as an `SVG` file in the current\n directory.\n\n Returns\n -------\n\n traceinv : float or numpy.array\n Trace of inverse of matrix.\n\n info : dict\n (Only if ``return_info`` is `True`) A dictionary of information with\n the following.\n\n * ``matrix``:\n * ``data_type``: `str`, {`float32`, `float64`, `float128`}. Type of\n the matrix data.\n * ``gram``: `bool`, whether the matrix `A` or its Gramian is\n considered.\n * ``exponent``: `float`, the exponent `p` in :math:`\\mathbf{A}^p`.\n * ``assume_matrix``: `str`, {`gen`, `sym`, `pos`, `sym_pos`},\n determines the type of matrix `A`.\n * ``size``: (int, int) The size of matrix `A`.\n * ``sparse``: `bool`, whether the matrix `A` is sparse or dense.\n * ``nnz``: `int`, if `A` is sparse, the number of non-zero elements\n of `A`.\n * ``density``: `float`, if `A` is sparse, the density of `A`, which\n is the `nnz` divided by size squared.\n * ``num_inquiries``: `int`, the size of inquiries of each parameter\n of the linear operator `A`. If `A` is a matrix, this is always\n `1`. ""If `A` is a type of :class:`AffineMatrixFunction`, this\n value is the number of :math:`t_i` parameters.\n\n * ``convergence``:\n * ``converged``: `bool`, whether the Monte-Carlo sampling\n converged.\n * ``min_num_samples``: `int`, the minimum number of Monte-Carlo\n iterations.\n * ``max_num_samples``: `int`, the maximum number of Monte-Carlo\n iterations.\n * ``num_outliers``: `int`, number of outliers found during search\n for outliers among the array of output.\n * ``num_samples_used``: `int`, number of Monte-Carlo samples used\n to produce the output. This is the total number of iterations\n minus the number of outliers.\n * ``samples``: `array` [`float`], an array of the size\n `max_num_samples`. The first few entries (`num_samples_used`) of\n this array are the output results of the Monte-Carlo sampling.\n The average of these samples is the final result. The rest of\n this array is `nan`.\n * ``samples_mean``: `float`, mean of the `samples` array, excluding\n the `nan` values.\n * ``samples_processed_order``: `array` [`int`], in parallel\n processing, samples are processed in non-sequential order. This\n array, which has the same size as `samples`, keeps track of the\n order in which each sample is processed.\n\n * ``error``:\n * ``absolute_error``: `float`, the absolute error of the\n convergence of samples.\n * ``confidence_level``: `float`, the confidence level used to\n calculate the error from standard deviation of samples.\n * ``error_atol``: `float`, the tolerance of absolute error of the\n convergence of samples.\n * ``error_rtol``: `float`, the tolerance of relative error of ""the\n convergence of samples.\n * ``outlier_significance_level``: `float`, the significance level\n used to determine the outliers in samples.\n * ``relative_error``: `float`, the relative error of the\n convergence of samples.\n\n * ``device``:\n * ``num_cpu_threads``: `int`, number of CPU threads used in shared\n memory parallel processing.\n * ``num_gpu_devices``: `int`, number of GPU devices used in the\n multi-GPU (GPU farm) computation.\n * ``num_gpu_multiprocessors``: `int`, number of GPU\n multi-processors.\n * ``num_gpu_threads_per_multiprocessor``: `int`, number of GPU\n threads on each GPU multi-processor.\n\n * ``time``:\n * ``tot_wall_time``: `float`, total elapsed time of computation.\n * ``alg_wall_time``: `float`, elapsed time of computation during\n only the algorithm execution.\n * ``cpu_proc_time``: `float`, the CPU processing time of\n computation.\n\n * ``solver``:\n * ``version``: `str`, version of imate.\n * ``method``: 'hutchinson'.\n * ``solver_tol``: `float`, tolerance of solving linear system.\n * ``orthogonalize``: `bool`, orthogonalization flag.\n * ``seed`` : `int`, seed value for random number generation.\n\n Raises\n ------\n\n ImportError\n If the package has not been compiled with GPU support, but ``gpu`` is\n set to `True`. To resolve the issue, set ``gpu`` to `False` to be able\n to use the existing installation. Alternatively, export the\n environment variable ``USE_CUDA=1`` and recompile the source code of\n the package.\n\n See Also\n --------\n\n imate.logdet\n imate.trace\n imate.schatten\n\n Notes\n -----\n\n **Computational Complexity:**\n\n This method uses the Hutc""hinson, which is a randomized algorithm. The\n computational complexity of this method is\n\n .. math::\n\n \\mathcal{O}((\\rho n^2s),\n\n where :math:`n` is the matrix size, :math:`\\rho` is the density of\n sparse matrix (for dense matrix, :math:`\\rho=1`), and :math:`s` is the\n number of samples (set with ``min_num_samples`` and ``max_num_samples``).\n\n This method can be used on very large matrices (:math:`n > 2^{12}`). The\n solution is an approximation.\n\n **Convergence criterion:**\n\n Let :math:`n_{\\min}` and :math:`n_{\\max}` be the minimum and maximum\n number of iterations respectively defined by ``min_num_samples`` and\n ``max_num_samples``. The iterations terminate at\n :math:`n_{\\min} \\leq i \\leq n_{\\max}` where :math:`i` is the\n iteration counter. The iterations stop earlier at :math:`i < n_{\\max}` if\n the convergence error of the mean of the samples is satisfied, as follows.\n\n Suppose :math:`s(j)` and :math:`\\sigma(i)` are respectively the mean and\n standard deviation of samples after :math:`j` iterations. The error of\n convergence, :math:`e(j)`, is defined by\n\n .. math::\n\n e(j) = \\frac{\\sigma(j)}{\\sqrt{j}} Z\n\n where :math:`Z` is the Z-score defined by\n\n .. math::\n\n Z = \\sqrt{2} \\mathrm{erf}^{-1}(\\phi).\n\n In the above, :math:`\\phi` is the confidence level and set by\n ``confidence_level`` argument, and :math:`\\mathrm{erf}^{-1}` is the\n inverse error function. A confidence level of 95%, for instance, means that\n the Z-score is 1.96, which means the confidence interval is\n :math:`\\pm 1.96 \\sigma`.\n\n The termination criterion is\n\n .. math::\n\n e(j) < \\epsilon_a + s(j) \\epsilon_r,\n\n where :math:`\\epsilon_{a}` and :math:`\\epsilon_r` are the absolute and\n relative error tolerances respectively, and they are set by ``error_atol``\n and ``error_rtol``.\n\n **Plotting:**\n\n If ``plot`""` is set to `True`, it plots the convergence of samples and their\n relative error.\n\n * If no graphical backend exists (such as running the code on a remote\n server or manually disabling the X11 backend), the plot will not be\n shown, rather, it will be saved as an ``svg`` file in the current\n directory.\n * If the executable ``latex`` is available on ``PATH``, the plot is\n rendered using :math:`\\rm\\LaTeX` and it may take slightly longer to\n produce the plot.\n * If :math:`\\rm\\LaTeX` is not installed, it uses any available San-Serif\n font to render the plot.\n\n To manually disable interactive plot display and save the plot as\n ``svg`` instead, add the following at the very beginning of your code\n before importing :mod:`imate`:\n\n .. code-block:: python\n\n >>> import os\n >>> os.environ['IMATE_NO_DISPLAY'] = 'True'\n\n References\n ----------\n\n * `Ubaru, S., Chen, J., and Saad, Y. (2017)\n <https://www-users.cs.umn.edu/~saad/PDF/ys-2016-04.pdf>`_,\n Fast Estimation of :math:`\\mathrm{tr}(F(A))` Via Stochastic Lanczos\n Quadrature, SIAM J. Matrix Anal. Appl., 38(4), 1075-1099.\n\n Examples\n --------\n\n **Basic Usage:**\n\n Compute the trace of :math:`\\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Import packages\n >>> from imate import toeplitz, traceinv\n\n >>> # Generate a sample matrix\n >>> A = toeplitz(2, 1, size=100)\n\n >>> # Compute trace of inverse\n >>> traceinv(A, p=2, method='hutchinson')\n 24.73726368966402\n\n Compute the trace of :math:`(\\mathbf{A}^{\\intercal} \\mathbf{A})^{-2}`:\n\n .. code-block:: python\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, gram=True, p=2, method='hutchinson')\n 17.751659383784748\n\n Compute the trace of :math:`\\mathbf{B} \\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Generate another"" sample matrix\n >>> B = toeplitz(4, 3, size=100)\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, p=2, method='hutchinson', B=B)\n 99.8817360381704\n\n Compute the trace of :math:`\\mathbf{B} \\mathbf{A}^{-2} \\mathbf{C}\n \\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Generate another sample matrix\n >>> C = toeplitz(5, 4, size=100)\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, p=2, method='hutchinson', B=B, C=C)\n 124.45436379980006\n\n Compute the trace of :math:`\\mathbf{B} (\\mathbf{A}^{\\intercal}\n \\mathbf{A})^{-2} \\mathbf{C} (\\mathbf{A}^{\\intercal} \\mathbf{A})^{-2}`:\n\n .. code-block:: python\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, gram=True, p=2, method='hutchinson', B=B, C=C)\n 5.517453125230929\n\n **Verbose output:**\n\n By setting ``verbose`` to `True`, useful info about the process is\n printed.\n\n .. literalinclude:: ../_static/data/imate.traceinv.hutchinson-verbose.txt\n :language: python\n\n **Output information:**\n\n Print information about the inner computation:\n\n .. code-block:: python\n\n >>> ti, info = traceinv(A, method='hutchinson', return_info=True)\n >>> print(ti)\n 50.059307947603585\n\n >>> # Print dictionary neatly using pprint\n >>> from pprint import pprint\n >>> pprint(info)\n {\n 'matrix': {\n 'assume_matrix': 'gen',\n 'data_type': b'float64',\n 'density': 0.0199,\n 'exponent': 1,\n 'gram': False,\n 'nnz': 199,\n 'num_inquiries': 1,\n 'size': (100, 100),\n 'sparse': True\n },\n 'convergence': {\n 'converged': False,\n 'max_num_samples': 50,\n 'min_num_samples': 10,\n 'num_outliers': 0,""\n 'num_samples_used': 50,\n 'samples': array([52.237154, ..., 51.37932704]),\n 'samples_mean': 50.059307947603585,\n 'samples_processed_order': array([ 0, ..., 49])\n },\n 'error': {\n 'absolute_error': 0.8111131801161796,\n 'confidence_level': 0.95,\n 'error_atol': 0.0,\n 'error_rtol': 0.01,\n 'outlier_significance_level': 0.001,\n 'relative_error': 0.016203044216375525\n },\n 'solver': {\n 'method': 'hutchinson',\n 'orthogonalize': True,\n 'seed': None,\n 'solver_tol': 1e-06,\n 'version': '0.16.0'\n },\n 'device': {\n 'num_cpu_threads': 8,\n 'num_gpu_devices': 0,\n 'num_gpu_multiprocessors': 0,\n 'num_gpu_threads_per_multiprocessor': 0\n },\n 'time': {\n 'alg_wall_time': 0.03236744087189436,\n 'cpu_proc_time': 0.047695197999999994,\n 'tot_wall_time': 0.033352302853018045\n }\n }\n\n **Large matrix:**\n\n Compute the trace of :math:`\\mathbf{A}^{-1}` for a very large sparse\n matrix using at least `100` samples.\n\n .. code-block:: python\n :emphasize-lines: 5, 6, 7\n\n >>> # Create a symmetric positive-definite matrix of size one million.\n >>> A = toeplitz(2, 1, size=1000000, gram=True)\n\n >>> # Approximate trace using hutchinson method\n >>> ti, info = traceinv(A, method='hutchinson', solver_tol=1e-4,\n ... assume_matrix='sym_pos', min_num_samples=100,\n ... max_num_samples=200, return_info=True)\n >>> print(ti)\n 333292.3226031165\n\n >>> # Find the time it took to compute the above\n >>> print(info['time'])""\n {\n 'tot_wall_time': 175.93423152901232,\n 'alg_wall_time': 119.86316476506181,\n 'cpu_proc_time': 572.180877451\n }\n\n Compare the result of the above approximation with the exact solution of\n the trace using the analytic relation for Toeplitz matrix. See\n :func:`imate.sample_matrices.toeplitz_traceinv` for details.\n\n .. code-block:: python\n\n >>> from imate.sample_matrices import toeplitz_traceinv\n >>> toeplitz_traceinv(2, 1, size=1000000, gram=True)\n 333333.2222222222\n\n It can be seen that the error of approximation is :math:`0.012 \\%`. This\n accuracy is remarkable considering that the computation on such a large\n matrix took on 119 seconds. Computing the trace of such a large matrix\n using any of the exact methods (such as ``exact`` or ``eigenvalue``) is\n infeasible.\n\n **Plotting:**\n\n By setting ``plot`` to `True`, plots of samples during Monte-Carlo\n iterations and the convergence of their mean are generated.\n\n .. code-block:: python\n\n >>> A = toeplitz(2, 1, size=1000000, gram=True)\n >>> traceinv(A, method='hutchinson', assume_matrix='sym_pos',\n ... solver_tol=1e-4, min_num_samples=50, max_num_samples=150,\n ... error_rtol=2e-4, confidence_level=0.95,\n ... outlier_significance_level=0.001, plot=True)\n\n .. image:: ../_static/images/plots/traceinv_hutchinson_convergence.png\n :align: center\n :class: custom-dark\n\n In the left plot, the samples are shown in circles and the cumulative mean\n of the samples is shown by a solid black curve. The shaded area corresponds\n to the 95% confidence interval :math:`\\pm 1.96 \\sigma`, which is set by\n ``confidence_level=0.95``. The samples outside the interval of 99.9% are\n considered outliers, which is set by the significance level\n ``outlier_significance_level=0.001``.\n\n In the rig""ht plot, the darker shaded area in the interval :math:`[0, 50]`\n shows the minimum number of samples and is set by ``min_num_samples=50``.\n The iterations do not stop till the minimum number of iterations is passed.\n We can observe that sampling is terminated after 140 iterations where the\n relative error of samples reaches 0.02% since we set ``error_rtol=2e-4``.\n The lighter shaded area in the interval :math:`[140, 150]` corresponds to\n the iterations that were not performed to reach the specified maximum\n iterations by ``max_num_samples=150``.\n ";
3012 static PyMethodDef __pyx_mdef_5imate_8traceinv_18_hutchinson_method_1hutchinson_method = {
"hutchinson_method", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_8traceinv_18_hutchinson_method_1hutchinson_method, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_8traceinv_18_hutchinson_method_hutchinson_method};
3013 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_1hutchinson_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3014 PyObject *__pyx_v_A = 0;
3015 PyObject *__pyx_v_gram = 0;
3016 PyObject *__pyx_v_p = 0;
3017 PyObject *__pyx_v_return_info = 0;
3018 PyObject *__pyx_v_B = 0;
3019 PyObject *__pyx_v_C = 0;
3020 PyObject *__pyx_v_assume_matrix = 0;
3021 PyObject *__pyx_v_min_num_samples = 0;
3022 PyObject *__pyx_v_max_num_samples = 0;
3023 PyObject *__pyx_v_error_atol = 0;
3024 PyObject *__pyx_v_error_rtol = 0;
3025 PyObject *__pyx_v_confidence_level = 0;
3026 PyObject *__pyx_v_outlier_significance_level = 0;
3027 PyObject *__pyx_v_solver_tol = 0;
3028 PyObject *__pyx_v_orthogonalize = 0;
3029 PyObject *__pyx_v_seed = 0;
3030 PyObject *__pyx_v_num_threads = 0;
3031 PyObject *__pyx_v_verbose = 0;
3032 PyObject *__pyx_v_plot = 0;
3033 int __pyx_lineno = 0;
3034 const char *__pyx_filename = NULL;
3035 int __pyx_clineno = 0;
3036 PyObject *__pyx_r = 0;
3037 __Pyx_RefNannyDeclarations
3038 __Pyx_RefNannySetupContext(
"hutchinson_method (wrapper)", 0);
3040 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_gram,&__pyx_n_s_p,&__pyx_n_s_return_info,&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_assume_matrix,&__pyx_n_s_min_num_samples,&__pyx_n_s_max_num_samples,&__pyx_n_s_error_atol,&__pyx_n_s_error_rtol,&__pyx_n_s_confidence_level,&__pyx_n_s_outlier_significance_level,&__pyx_n_s_solver_tol,&__pyx_n_s_orthogonalize,&__pyx_n_s_seed,&__pyx_n_s_num_threads,&__pyx_n_s_verbose,&__pyx_n_s_plot,0};
3041 PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
3050 values[1] = ((PyObject *)((PyObject *)Py_False));
3051 values[2] = ((PyObject *)((PyObject *)__pyx_int_1));
3060 values[3] = ((PyObject *)((PyObject *)Py_False));
3069 values[4] = ((PyObject *)((PyObject *)Py_None));
3078 values[5] = ((PyObject *)((PyObject *)Py_None));
3079 values[6] = ((PyObject *)((PyObject*)__pyx_n_u_gen));
3080 values[7] = ((PyObject *)((PyObject *)__pyx_int_10));
3081 values[8] = ((PyObject *)((PyObject *)__pyx_int_50));
3090 values[9] = ((PyObject *)((PyObject *)Py_None));
3091 values[10] = ((PyObject *)((PyObject*)__pyx_float_1eneg_2));
3092 values[11] = ((PyObject *)((PyObject*)__pyx_float_0_95));
3093 values[12] = ((PyObject *)((PyObject*)__pyx_float_0_001));
3094 values[13] = ((PyObject *)((PyObject*)__pyx_float_1eneg_6));
3103 values[14] = ((PyObject *)((PyObject *)Py_True));
3112 values[15] = ((PyObject *)((PyObject *)Py_None));
3113 values[16] = ((PyObject *)((PyObject *)__pyx_int_0));
3122 values[17] = ((PyObject *)((PyObject *)Py_False));
3131 values[18] = ((PyObject *)((PyObject *)Py_False));
3132 if (unlikely(__pyx_kwds)) {
3134 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3136 case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
3138 case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
3140 case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
3142 case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
3144 case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
3146 case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
3148 case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
3150 case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3152 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3154 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3156 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3158 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3160 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3162 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3164 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3166 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3168 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3170 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3172 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3175 default:
goto __pyx_L5_argtuple_error;
3177 kw_args = PyDict_Size(__pyx_kwds);
3180 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
3181 else goto __pyx_L5_argtuple_error;
3185 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gram);
3186 if (value) { values[1] = value; kw_args--; }
3191 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
3192 if (value) { values[2] = value; kw_args--; }
3197 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_info);
3198 if (value) { values[3] = value; kw_args--; }
3203 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
3204 if (value) { values[4] = value; kw_args--; }
3209 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
3210 if (value) { values[5] = value; kw_args--; }
3215 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_assume_matrix);
3216 if (value) { values[6] = value; kw_args--; }
3221 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_num_samples);
3222 if (value) { values[7] = value; kw_args--; }
3227 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_num_samples);
3228 if (value) { values[8] = value; kw_args--; }
3233 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_atol);
3234 if (value) { values[9] = value; kw_args--; }
3239 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_rtol);
3240 if (value) { values[10] = value; kw_args--; }
3245 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_confidence_level);
3246 if (value) { values[11] = value; kw_args--; }
3251 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outlier_significance_level);
3252 if (value) { values[12] = value; kw_args--; }
3257 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_solver_tol);
3258 if (value) { values[13] = value; kw_args--; }
3263 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_orthogonalize);
3264 if (value) { values[14] = value; kw_args--; }
3269 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed);
3270 if (value) { values[15] = value; kw_args--; }
3275 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads);
3276 if (value) { values[16] = value; kw_args--; }
3281 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
3282 if (value) { values[17] = value; kw_args--; }
3287 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_plot);
3288 if (value) { values[18] = value; kw_args--; }
3291 if (unlikely(kw_args > 0)) {
3292 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"hutchinson_method") < 0)) __PYX_ERR(0, 37, __pyx_L3_error)
3295 switch (PyTuple_GET_SIZE(__pyx_args)) {
3296 case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
3298 case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
3300 case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
3302 case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
3304 case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
3306 case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
3308 case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
3310 case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3312 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3314 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3316 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3318 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3320 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3322 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3324 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3326 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3328 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3330 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3332 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3334 default:
goto __pyx_L5_argtuple_error;
3337 __pyx_v_A = values[0];
3338 __pyx_v_gram = values[1];
3339 __pyx_v_p = values[2];
3340 __pyx_v_return_info = values[3];
3341 __pyx_v_B = values[4];
3342 __pyx_v_C = values[5];
3343 __pyx_v_assume_matrix = values[6];
3344 __pyx_v_min_num_samples = values[7];
3345 __pyx_v_max_num_samples = values[8];
3346 __pyx_v_error_atol = values[9];
3347 __pyx_v_error_rtol = values[10];
3348 __pyx_v_confidence_level = values[11];
3349 __pyx_v_outlier_significance_level = values[12];
3350 __pyx_v_solver_tol = values[13];
3351 __pyx_v_orthogonalize = values[14];
3352 __pyx_v_seed = values[15];
3353 __pyx_v_num_threads = values[16];
3354 __pyx_v_verbose = values[17];
3355 __pyx_v_plot = values[18];
3357 goto __pyx_L4_argument_unpacking_done;
3358 __pyx_L5_argtuple_error:;
3359 __Pyx_RaiseArgtupleInvalid(
"hutchinson_method", 0, 1, 19, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 37, __pyx_L3_error)
3361 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method.hutchinson_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
3362 __Pyx_RefNannyFinishContext();
3364 __pyx_L4_argument_unpacking_done:;
3365 __pyx_r = __pyx_pf_5imate_8traceinv_18_hutchinson_method_hutchinson_method(__pyx_self, __pyx_v_A, __pyx_v_gram, __pyx_v_p, __pyx_v_return_info, __pyx_v_B, __pyx_v_C, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads, __pyx_v_verbose, __pyx_v_plot);
3376 __Pyx_RefNannyFinishContext();
3380 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_hutchinson_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_return_info, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_verbose, PyObject *__pyx_v_plot) {
3381 CYTHON_UNUSED PyObject *__pyx_v_square = NULL;
3382 PyObject *__pyx_v_data_type_name = NULL;
3383 PyObject *__pyx_v_trace = NULL;
3384 PyObject *__pyx_v_error = NULL;
3385 PyObject *__pyx_v_num_outliers = NULL;
3386 PyObject *__pyx_v_samples = NULL;
3387 PyObject *__pyx_v_processed_samples_indices = NULL;
3388 CYTHON_UNUSED PyObject *__pyx_v_num_processed_samples = NULL;
3389 PyObject *__pyx_v_num_samples_used = NULL;
3390 PyObject *__pyx_v_converged = NULL;
3391 PyObject *__pyx_v_tot_wall_time = NULL;
3392 PyObject *__pyx_v_alg_wall_time = NULL;
3393 PyObject *__pyx_v_cpu_proc_time = NULL;
3394 PyObject *__pyx_v_info = NULL;
3395 PyObject *__pyx_r = NULL;
3396 __Pyx_TraceDeclarations
3397 __Pyx_RefNannyDeclarations
3398 PyObject *__pyx_t_1 = NULL;
3399 PyObject *__pyx_t_2 = NULL;
3400 PyObject *__pyx_t_3 = NULL;
3402 PyObject *__pyx_t_5 = NULL;
3403 PyObject *__pyx_t_6 = NULL;
3404 PyObject *(*__pyx_t_7)(PyObject *);
3407 PyObject *__pyx_t_10 = NULL;
3408 PyObject *__pyx_t_11 = NULL;
3409 PyObject *__pyx_t_12 = NULL;
3410 PyObject *__pyx_t_13 = NULL;
3411 PyObject *__pyx_t_14 = NULL;
3412 PyObject *__pyx_t_15 = NULL;
3413 PyObject *__pyx_t_16 = NULL;
3414 PyObject *__pyx_t_17 = NULL;
3415 int __pyx_lineno = 0;
3416 const char *__pyx_filename = NULL;
3417 int __pyx_clineno = 0;
3418 __Pyx_TraceFrameInit(__pyx_codeobj_)
3419 __Pyx_RefNannySetupContext(
"hutchinson_method", 0);
3420 __Pyx_TraceCall(
"hutchinson_method", __pyx_f[0], 37, 0, __PYX_ERR(0, 37, __pyx_L1_error));
3421 __Pyx_INCREF(__pyx_v_min_num_samples);
3422 __Pyx_INCREF(__pyx_v_max_num_samples);
3423 __Pyx_INCREF(__pyx_v_error_atol);
3424 __Pyx_INCREF(__pyx_v_error_rtol);
3425 __Pyx_INCREF(__pyx_v_seed);
3426 __Pyx_INCREF(__pyx_v_num_threads);
3435 __Pyx_TraceLine(614,0,__PYX_ERR(0, 614, __pyx_L1_error))
3436 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_arguments);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error)
3437 __Pyx_GOTREF(__pyx_t_2);
3446 __Pyx_TraceLine(618,0,__PYX_ERR(0, 618, __pyx_L1_error))
3449 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3450 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3451 if (likely(__pyx_t_3)) {
3452 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
3453 __Pyx_INCREF(__pyx_t_3);
3454 __Pyx_INCREF(
function);
3455 __Pyx_DECREF_SET(__pyx_t_2,
function);
3459 #if CYTHON_FAST_PYCALL
3460 if (PyFunction_Check(__pyx_t_2)) {
3461 PyObject *__pyx_temp[20] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_return_info, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads, __pyx_v_verbose, __pyx_v_plot};
3462 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 19+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
3463 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3464 __Pyx_GOTREF(__pyx_t_1);
3467 #if CYTHON_FAST_PYCCALL
3468 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3469 PyObject *__pyx_temp[20] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_return_info, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads, __pyx_v_verbose, __pyx_v_plot};
3470 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 19+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
3471 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3472 __Pyx_GOTREF(__pyx_t_1);
3476 __pyx_t_5 = PyTuple_New(19+__pyx_t_4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 614, __pyx_L1_error)
3477 __Pyx_GOTREF(__pyx_t_5);
3479 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
3481 __Pyx_INCREF(__pyx_v_A);
3482 __Pyx_GIVEREF(__pyx_v_A);
3483 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_A);
3484 __Pyx_INCREF(__pyx_v_B);
3485 __Pyx_GIVEREF(__pyx_v_B);
3486 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_B);
3487 __Pyx_INCREF(__pyx_v_C);
3488 __Pyx_GIVEREF(__pyx_v_C);
3489 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_C);
3490 __Pyx_INCREF(__pyx_v_gram);
3491 __Pyx_GIVEREF(__pyx_v_gram);
3492 PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_gram);
3493 __Pyx_INCREF(__pyx_v_p);
3494 __Pyx_GIVEREF(__pyx_v_p);
3495 PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_p);
3496 __Pyx_INCREF(__pyx_v_return_info);
3497 __Pyx_GIVEREF(__pyx_v_return_info);
3498 PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_return_info);
3499 __Pyx_INCREF(__pyx_v_assume_matrix);
3500 __Pyx_GIVEREF(__pyx_v_assume_matrix);
3501 PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_assume_matrix);
3502 __Pyx_INCREF(__pyx_v_min_num_samples);
3503 __Pyx_GIVEREF(__pyx_v_min_num_samples);
3504 PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_min_num_samples);
3505 __Pyx_INCREF(__pyx_v_max_num_samples);
3506 __Pyx_GIVEREF(__pyx_v_max_num_samples);
3507 PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_max_num_samples);
3508 __Pyx_INCREF(__pyx_v_error_atol);
3509 __Pyx_GIVEREF(__pyx_v_error_atol);
3510 PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_error_atol);
3511 __Pyx_INCREF(__pyx_v_error_rtol);
3512 __Pyx_GIVEREF(__pyx_v_error_rtol);
3513 PyTuple_SET_ITEM(__pyx_t_5, 10+__pyx_t_4, __pyx_v_error_rtol);
3514 __Pyx_INCREF(__pyx_v_confidence_level);
3515 __Pyx_GIVEREF(__pyx_v_confidence_level);
3516 PyTuple_SET_ITEM(__pyx_t_5, 11+__pyx_t_4, __pyx_v_confidence_level);
3517 __Pyx_INCREF(__pyx_v_outlier_significance_level);
3518 __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
3519 PyTuple_SET_ITEM(__pyx_t_5, 12+__pyx_t_4, __pyx_v_outlier_significance_level);
3520 __Pyx_INCREF(__pyx_v_solver_tol);
3521 __Pyx_GIVEREF(__pyx_v_solver_tol);
3522 PyTuple_SET_ITEM(__pyx_t_5, 13+__pyx_t_4, __pyx_v_solver_tol);
3523 __Pyx_INCREF(__pyx_v_orthogonalize);
3524 __Pyx_GIVEREF(__pyx_v_orthogonalize);
3525 PyTuple_SET_ITEM(__pyx_t_5, 14+__pyx_t_4, __pyx_v_orthogonalize);
3526 __Pyx_INCREF(__pyx_v_seed);
3527 __Pyx_GIVEREF(__pyx_v_seed);
3528 PyTuple_SET_ITEM(__pyx_t_5, 15+__pyx_t_4, __pyx_v_seed);
3529 __Pyx_INCREF(__pyx_v_num_threads);
3530 __Pyx_GIVEREF(__pyx_v_num_threads);
3531 PyTuple_SET_ITEM(__pyx_t_5, 16+__pyx_t_4, __pyx_v_num_threads);
3532 __Pyx_INCREF(__pyx_v_verbose);
3533 __Pyx_GIVEREF(__pyx_v_verbose);
3534 PyTuple_SET_ITEM(__pyx_t_5, 17+__pyx_t_4, __pyx_v_verbose);
3535 __Pyx_INCREF(__pyx_v_plot);
3536 __Pyx_GIVEREF(__pyx_v_plot);
3537 PyTuple_SET_ITEM(__pyx_t_5, 18+__pyx_t_4, __pyx_v_plot);
3538 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
3539 __Pyx_GOTREF(__pyx_t_1);
3540 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3542 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3543 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
3544 PyObject* sequence = __pyx_t_1;
3545 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3546 if (unlikely(size != 3)) {
3547 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
3548 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3549 __PYX_ERR(0, 614, __pyx_L1_error)
3551 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3552 if (likely(PyTuple_CheckExact(sequence))) {
3553 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
3554 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
3555 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
3557 __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
3558 __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
3559 __pyx_t_3 = PyList_GET_ITEM(sequence, 2);
3561 __Pyx_INCREF(__pyx_t_2);
3562 __Pyx_INCREF(__pyx_t_5);
3563 __Pyx_INCREF(__pyx_t_3);
3565 __pyx_t_2 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error)
3566 __Pyx_GOTREF(__pyx_t_2);
3567 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 614, __pyx_L1_error)
3568 __Pyx_GOTREF(__pyx_t_5);
3569 __pyx_t_3 = PySequence_ITEM(sequence, 2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L1_error)
3570 __Pyx_GOTREF(__pyx_t_3);
3572 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3574 Py_ssize_t index = -1;
3575 __pyx_t_6 = PyObject_GetIter(__pyx_t_1);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 614, __pyx_L1_error)
3576 __Pyx_GOTREF(__pyx_t_6);
3577 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3578 __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
3579 index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6);
if (unlikely(!__pyx_t_2))
goto __pyx_L3_unpacking_failed;
3580 __Pyx_GOTREF(__pyx_t_2);
3581 index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6);
if (unlikely(!__pyx_t_5))
goto __pyx_L3_unpacking_failed;
3582 __Pyx_GOTREF(__pyx_t_5);
3583 index = 2; __pyx_t_3 = __pyx_t_7(__pyx_t_6);
if (unlikely(!__pyx_t_3))
goto __pyx_L3_unpacking_failed;
3584 __Pyx_GOTREF(__pyx_t_3);
3585 if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
3587 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3588 goto __pyx_L4_unpacking_done;
3589 __pyx_L3_unpacking_failed:;
3590 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3592 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3593 __PYX_ERR(0, 614, __pyx_L1_error)
3594 __pyx_L4_unpacking_done:;
3604 __Pyx_TraceLine(614,0,__PYX_ERR(0, 614, __pyx_L1_error))
3605 __Pyx_DECREF_SET(__pyx_v_error_atol, __pyx_t_2);
3607 __Pyx_DECREF_SET(__pyx_v_error_rtol, __pyx_t_5);
3609 __pyx_v_square = __pyx_t_3;
3619 __Pyx_TraceLine(623,0,__PYX_ERR(0, 623, __pyx_L1_error))
3620 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
3621 __Pyx_GOTREF(__pyx_t_1);
3622 __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error)
3623 __Pyx_GOTREF(__pyx_t_3);
3624 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3625 __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_max_num_samples, Py_LT); __Pyx_XGOTREF(__pyx_t_1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
3626 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3627 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1);
if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 623, __pyx_L1_error)
3628 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3638 __Pyx_TraceLine(624,0,__PYX_ERR(0, 624, __pyx_L1_error))
3639 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
3640 __Pyx_GOTREF(__pyx_t_1);
3641 __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
3642 __Pyx_GOTREF(__pyx_t_3);
3643 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3644 __Pyx_DECREF_SET(__pyx_v_max_num_samples, __pyx_t_3);
3663 __Pyx_TraceLine(625,0,__PYX_ERR(0, 625, __pyx_L1_error))
3664 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)
3665 __Pyx_GOTREF(__pyx_t_3);
3666 __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error)
3667 __Pyx_GOTREF(__pyx_t_1);
3668 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3669 __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_min_num_samples, Py_LT); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)
3670 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3671 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 625, __pyx_L1_error)
3672 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3682 __Pyx_TraceLine(626,0,__PYX_ERR(0, 626, __pyx_L1_error))
3683 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error)
3684 __Pyx_GOTREF(__pyx_t_3);
3685 __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
3686 __Pyx_GOTREF(__pyx_t_1);
3687 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3688 __Pyx_DECREF_SET(__pyx_v_min_num_samples, __pyx_t_1);
3707 __Pyx_TraceLine(630,0,__PYX_ERR(0, 630, __pyx_L1_error))
3708 __pyx_t_8 = (__pyx_v_seed == Py_None);
3709 __pyx_t_9 = (__pyx_t_8 != 0);
3719 __Pyx_TraceLine(631,0,__PYX_ERR(0, 631, __pyx_L1_error))
3720 __Pyx_INCREF(__pyx_int_neg_1);
3721 __Pyx_DECREF_SET(__pyx_v_seed, __pyx_int_neg_1);
3739 __Pyx_TraceLine(634,0,__PYX_ERR(0, 634, __pyx_L1_error))
3740 __pyx_t_1 = PyObject_RichCompare(__pyx_v_num_threads, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
3741 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1);
if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 634, __pyx_L1_error)
3742 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3752 __Pyx_TraceLine(635,0,__PYX_ERR(0, 635, __pyx_L1_error))
3753 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_multiprocessing);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error)
3754 __Pyx_GOTREF(__pyx_t_3);
3755 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cpu_count);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 635, __pyx_L1_error)
3756 __Pyx_GOTREF(__pyx_t_5);
3757 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3759 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3760 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
3761 if (likely(__pyx_t_3)) {
3762 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
3763 __Pyx_INCREF(__pyx_t_3);
3764 __Pyx_INCREF(
function);
3765 __Pyx_DECREF_SET(__pyx_t_5,
function);
3768 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
3769 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3770 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error)
3771 __Pyx_GOTREF(__pyx_t_1);
3772 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3773 __Pyx_DECREF_SET(__pyx_v_num_threads, __pyx_t_1);
3792 __Pyx_TraceLine(638,0,__PYX_ERR(0, 638, __pyx_L1_error))
3793 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_get_data_type_name);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L1_error)
3794 __Pyx_GOTREF(__pyx_t_5);
3796 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3797 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
3798 if (likely(__pyx_t_3)) {
3799 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
3800 __Pyx_INCREF(__pyx_t_3);
3801 __Pyx_INCREF(
function);
3802 __Pyx_DECREF_SET(__pyx_t_5,
function);
3805 __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_A);
3806 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3807 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error)
3808 __Pyx_GOTREF(__pyx_t_1);
3809 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3810 __pyx_v_data_type_name = __pyx_t_1;
3820 __Pyx_TraceLine(639,0,__PYX_ERR(0, 639, __pyx_L1_error))
3821 __pyx_t_9 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float32, Py_EQ));
if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 639, __pyx_L1_error)
3831 __Pyx_TraceLine(643,0,__PYX_ERR(0, 643, __pyx_L1_error))
3832 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_hutchinson_method_float);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L1_error)
3833 __Pyx_GOTREF(__pyx_t_5);
3842 __Pyx_TraceLine(649,0,__PYX_ERR(0, 649, __pyx_L1_error))
3845 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3846 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
3847 if (likely(__pyx_t_3)) {
3848 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
3849 __Pyx_INCREF(__pyx_t_3);
3850 __Pyx_INCREF(
function);
3851 __Pyx_DECREF_SET(__pyx_t_5,
function);
3855 #if CYTHON_FAST_PYCALL
3856 if (PyFunction_Check(__pyx_t_5)) {
3857 PyObject *__pyx_temp[17] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads};
3858 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 16+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
3859 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3860 __Pyx_GOTREF(__pyx_t_1);
3863 #if CYTHON_FAST_PYCCALL
3864 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
3865 PyObject *__pyx_temp[17] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads};
3866 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 16+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
3867 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3868 __Pyx_GOTREF(__pyx_t_1);
3872 __pyx_t_2 = PyTuple_New(16+__pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error)
3873 __Pyx_GOTREF(__pyx_t_2);
3875 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
3877 __Pyx_INCREF(__pyx_v_A);
3878 __Pyx_GIVEREF(__pyx_v_A);
3879 PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_v_A);
3880 __Pyx_INCREF(__pyx_v_B);
3881 __Pyx_GIVEREF(__pyx_v_B);
3882 PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_B);
3883 __Pyx_INCREF(__pyx_v_C);
3884 __Pyx_GIVEREF(__pyx_v_C);
3885 PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_4, __pyx_v_C);
3886 __Pyx_INCREF(__pyx_v_gram);
3887 __Pyx_GIVEREF(__pyx_v_gram);
3888 PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_4, __pyx_v_gram);
3889 __Pyx_INCREF(__pyx_v_p);
3890 __Pyx_GIVEREF(__pyx_v_p);
3891 PyTuple_SET_ITEM(__pyx_t_2, 4+__pyx_t_4, __pyx_v_p);
3892 __Pyx_INCREF(__pyx_v_assume_matrix);
3893 __Pyx_GIVEREF(__pyx_v_assume_matrix);
3894 PyTuple_SET_ITEM(__pyx_t_2, 5+__pyx_t_4, __pyx_v_assume_matrix);
3895 __Pyx_INCREF(__pyx_v_min_num_samples);
3896 __Pyx_GIVEREF(__pyx_v_min_num_samples);
3897 PyTuple_SET_ITEM(__pyx_t_2, 6+__pyx_t_4, __pyx_v_min_num_samples);
3898 __Pyx_INCREF(__pyx_v_max_num_samples);
3899 __Pyx_GIVEREF(__pyx_v_max_num_samples);
3900 PyTuple_SET_ITEM(__pyx_t_2, 7+__pyx_t_4, __pyx_v_max_num_samples);
3901 __Pyx_INCREF(__pyx_v_error_atol);
3902 __Pyx_GIVEREF(__pyx_v_error_atol);
3903 PyTuple_SET_ITEM(__pyx_t_2, 8+__pyx_t_4, __pyx_v_error_atol);
3904 __Pyx_INCREF(__pyx_v_error_rtol);
3905 __Pyx_GIVEREF(__pyx_v_error_rtol);
3906 PyTuple_SET_ITEM(__pyx_t_2, 9+__pyx_t_4, __pyx_v_error_rtol);
3907 __Pyx_INCREF(__pyx_v_confidence_level);
3908 __Pyx_GIVEREF(__pyx_v_confidence_level);
3909 PyTuple_SET_ITEM(__pyx_t_2, 10+__pyx_t_4, __pyx_v_confidence_level);
3910 __Pyx_INCREF(__pyx_v_outlier_significance_level);
3911 __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
3912 PyTuple_SET_ITEM(__pyx_t_2, 11+__pyx_t_4, __pyx_v_outlier_significance_level);
3913 __Pyx_INCREF(__pyx_v_solver_tol);
3914 __Pyx_GIVEREF(__pyx_v_solver_tol);
3915 PyTuple_SET_ITEM(__pyx_t_2, 12+__pyx_t_4, __pyx_v_solver_tol);
3916 __Pyx_INCREF(__pyx_v_orthogonalize);
3917 __Pyx_GIVEREF(__pyx_v_orthogonalize);
3918 PyTuple_SET_ITEM(__pyx_t_2, 13+__pyx_t_4, __pyx_v_orthogonalize);
3919 __Pyx_INCREF(__pyx_v_seed);
3920 __Pyx_GIVEREF(__pyx_v_seed);
3921 PyTuple_SET_ITEM(__pyx_t_2, 14+__pyx_t_4, __pyx_v_seed);
3922 __Pyx_INCREF(__pyx_v_num_threads);
3923 __Pyx_GIVEREF(__pyx_v_num_threads);
3924 PyTuple_SET_ITEM(__pyx_t_2, 15+__pyx_t_4, __pyx_v_num_threads);
3925 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
3926 __Pyx_GOTREF(__pyx_t_1);
3927 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3929 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3930 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
3931 PyObject* sequence = __pyx_t_1;
3932 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3933 if (unlikely(size != 11)) {
3934 if (size > 11) __Pyx_RaiseTooManyValuesError(11);
3935 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3936 __PYX_ERR(0, 640, __pyx_L1_error)
3938 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3939 if (likely(PyTuple_CheckExact(sequence))) {
3940 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
3941 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
3942 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
3943 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
3944 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 4);
3945 __pyx_t_11 = PyTuple_GET_ITEM(sequence, 5);
3946 __pyx_t_12 = PyTuple_GET_ITEM(sequence, 6);
3947 __pyx_t_13 = PyTuple_GET_ITEM(sequence, 7);
3948 __pyx_t_14 = PyTuple_GET_ITEM(sequence, 8);
3949 __pyx_t_15 = PyTuple_GET_ITEM(sequence, 9);
3950 __pyx_t_16 = PyTuple_GET_ITEM(sequence, 10);
3952 __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
3953 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
3954 __pyx_t_3 = PyList_GET_ITEM(sequence, 2);
3955 __pyx_t_6 = PyList_GET_ITEM(sequence, 3);
3956 __pyx_t_10 = PyList_GET_ITEM(sequence, 4);
3957 __pyx_t_11 = PyList_GET_ITEM(sequence, 5);
3958 __pyx_t_12 = PyList_GET_ITEM(sequence, 6);
3959 __pyx_t_13 = PyList_GET_ITEM(sequence, 7);
3960 __pyx_t_14 = PyList_GET_ITEM(sequence, 8);
3961 __pyx_t_15 = PyList_GET_ITEM(sequence, 9);
3962 __pyx_t_16 = PyList_GET_ITEM(sequence, 10);
3964 __Pyx_INCREF(__pyx_t_5);
3965 __Pyx_INCREF(__pyx_t_2);
3966 __Pyx_INCREF(__pyx_t_3);
3967 __Pyx_INCREF(__pyx_t_6);
3968 __Pyx_INCREF(__pyx_t_10);
3969 __Pyx_INCREF(__pyx_t_11);
3970 __Pyx_INCREF(__pyx_t_12);
3971 __Pyx_INCREF(__pyx_t_13);
3972 __Pyx_INCREF(__pyx_t_14);
3973 __Pyx_INCREF(__pyx_t_15);
3974 __Pyx_INCREF(__pyx_t_16);
3978 PyObject** temps[11] = {&__pyx_t_5,&__pyx_t_2,&__pyx_t_3,&__pyx_t_6,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14,&__pyx_t_15,&__pyx_t_16};
3979 for (i=0; i < 11; i++) {
3980 PyObject* item = PySequence_ITEM(sequence, i);
if (unlikely(!item)) __PYX_ERR(0, 640, __pyx_L1_error)
3986 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3988 Py_ssize_t index = -1;
3989 PyObject** temps[11] = {&__pyx_t_5,&__pyx_t_2,&__pyx_t_3,&__pyx_t_6,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14,&__pyx_t_15,&__pyx_t_16};
3990 __pyx_t_17 = PyObject_GetIter(__pyx_t_1);
if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 640, __pyx_L1_error)
3991 __Pyx_GOTREF(__pyx_t_17);
3992 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3993 __pyx_t_7 = Py_TYPE(__pyx_t_17)->tp_iternext;
3994 for (index=0; index < 11; index++) {
3995 PyObject* item = __pyx_t_7(__pyx_t_17);
if (unlikely(!item))
goto __pyx_L10_unpacking_failed;
3997 *(temps[index]) = item;
3999 if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_17), 11) < 0) __PYX_ERR(0, 640, __pyx_L1_error)
4001 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4002 goto __pyx_L11_unpacking_done;
4003 __pyx_L10_unpacking_failed:;
4004 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4006 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4007 __PYX_ERR(0, 640, __pyx_L1_error)
4008 __pyx_L11_unpacking_done:;
4018 __Pyx_TraceLine(640,0,__PYX_ERR(0, 640, __pyx_L1_error))
4019 __pyx_v_trace = __pyx_t_5;
4021 __pyx_v_error = __pyx_t_2;
4023 __pyx_v_num_outliers = __pyx_t_3;
4025 __pyx_v_samples = __pyx_t_6;
4027 __pyx_v_processed_samples_indices = __pyx_t_10;
4029 __pyx_v_num_processed_samples = __pyx_t_11;
4031 __pyx_v_num_samples_used = __pyx_t_12;
4033 __pyx_v_converged = __pyx_t_13;
4035 __pyx_v_tot_wall_time = __pyx_t_14;
4037 __pyx_v_alg_wall_time = __pyx_t_15;
4039 __pyx_v_cpu_proc_time = __pyx_t_16;
4059 __Pyx_TraceLine(651,0,__PYX_ERR(0, 651, __pyx_L1_error))
4060 __pyx_t_9 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float64, Py_EQ));
if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 651, __pyx_L1_error)
4061 if (likely(__pyx_t_9)) {
4070 __Pyx_TraceLine(655,0,__PYX_ERR(0, 655, __pyx_L1_error))
4071 __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_hutchinson_method_double);
if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 655, __pyx_L1_error)
4072 __Pyx_GOTREF(__pyx_t_16);
4081 __Pyx_TraceLine(661,0,__PYX_ERR(0, 661, __pyx_L1_error))
4084 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
4085 __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_16);
4086 if (likely(__pyx_t_15)) {
4087 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_16);
4088 __Pyx_INCREF(__pyx_t_15);
4089 __Pyx_INCREF(
function);
4090 __Pyx_DECREF_SET(__pyx_t_16,
function);
4094 #if CYTHON_FAST_PYCALL
4095 if (PyFunction_Check(__pyx_t_16)) {
4096 PyObject *__pyx_temp[17] = {__pyx_t_15, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads};
4097 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_4, 16+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
4098 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
4099 __Pyx_GOTREF(__pyx_t_1);
4102 #if CYTHON_FAST_PYCCALL
4103 if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
4104 PyObject *__pyx_temp[17] = {__pyx_t_15, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads};
4105 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_4, 16+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
4106 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
4107 __Pyx_GOTREF(__pyx_t_1);
4111 __pyx_t_14 = PyTuple_New(16+__pyx_t_4);
if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 655, __pyx_L1_error)
4112 __Pyx_GOTREF(__pyx_t_14);
4114 __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); __pyx_t_15 = NULL;
4116 __Pyx_INCREF(__pyx_v_A);
4117 __Pyx_GIVEREF(__pyx_v_A);
4118 PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_4, __pyx_v_A);
4119 __Pyx_INCREF(__pyx_v_B);
4120 __Pyx_GIVEREF(__pyx_v_B);
4121 PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_4, __pyx_v_B);
4122 __Pyx_INCREF(__pyx_v_C);
4123 __Pyx_GIVEREF(__pyx_v_C);
4124 PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_4, __pyx_v_C);
4125 __Pyx_INCREF(__pyx_v_gram);
4126 __Pyx_GIVEREF(__pyx_v_gram);
4127 PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_4, __pyx_v_gram);
4128 __Pyx_INCREF(__pyx_v_p);
4129 __Pyx_GIVEREF(__pyx_v_p);
4130 PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_4, __pyx_v_p);
4131 __Pyx_INCREF(__pyx_v_assume_matrix);
4132 __Pyx_GIVEREF(__pyx_v_assume_matrix);
4133 PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_4, __pyx_v_assume_matrix);
4134 __Pyx_INCREF(__pyx_v_min_num_samples);
4135 __Pyx_GIVEREF(__pyx_v_min_num_samples);
4136 PyTuple_SET_ITEM(__pyx_t_14, 6+__pyx_t_4, __pyx_v_min_num_samples);
4137 __Pyx_INCREF(__pyx_v_max_num_samples);
4138 __Pyx_GIVEREF(__pyx_v_max_num_samples);
4139 PyTuple_SET_ITEM(__pyx_t_14, 7+__pyx_t_4, __pyx_v_max_num_samples);
4140 __Pyx_INCREF(__pyx_v_error_atol);
4141 __Pyx_GIVEREF(__pyx_v_error_atol);
4142 PyTuple_SET_ITEM(__pyx_t_14, 8+__pyx_t_4, __pyx_v_error_atol);
4143 __Pyx_INCREF(__pyx_v_error_rtol);
4144 __Pyx_GIVEREF(__pyx_v_error_rtol);
4145 PyTuple_SET_ITEM(__pyx_t_14, 9+__pyx_t_4, __pyx_v_error_rtol);
4146 __Pyx_INCREF(__pyx_v_confidence_level);
4147 __Pyx_GIVEREF(__pyx_v_confidence_level);
4148 PyTuple_SET_ITEM(__pyx_t_14, 10+__pyx_t_4, __pyx_v_confidence_level);
4149 __Pyx_INCREF(__pyx_v_outlier_significance_level);
4150 __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
4151 PyTuple_SET_ITEM(__pyx_t_14, 11+__pyx_t_4, __pyx_v_outlier_significance_level);
4152 __Pyx_INCREF(__pyx_v_solver_tol);
4153 __Pyx_GIVEREF(__pyx_v_solver_tol);
4154 PyTuple_SET_ITEM(__pyx_t_14, 12+__pyx_t_4, __pyx_v_solver_tol);
4155 __Pyx_INCREF(__pyx_v_orthogonalize);
4156 __Pyx_GIVEREF(__pyx_v_orthogonalize);
4157 PyTuple_SET_ITEM(__pyx_t_14, 13+__pyx_t_4, __pyx_v_orthogonalize);
4158 __Pyx_INCREF(__pyx_v_seed);
4159 __Pyx_GIVEREF(__pyx_v_seed);
4160 PyTuple_SET_ITEM(__pyx_t_14, 14+__pyx_t_4, __pyx_v_seed);
4161 __Pyx_INCREF(__pyx_v_num_threads);
4162 __Pyx_GIVEREF(__pyx_v_num_threads);
4163 PyTuple_SET_ITEM(__pyx_t_14, 15+__pyx_t_4, __pyx_v_num_threads);
4164 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_14, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
4165 __Pyx_GOTREF(__pyx_t_1);
4166 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4168 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
4169 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
4170 PyObject* sequence = __pyx_t_1;
4171 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4172 if (unlikely(size != 11)) {
4173 if (size > 11) __Pyx_RaiseTooManyValuesError(11);
4174 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4175 __PYX_ERR(0, 652, __pyx_L1_error)
4177 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4178 if (likely(PyTuple_CheckExact(sequence))) {
4179 __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0);
4180 __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1);
4181 __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2);
4182 __pyx_t_13 = PyTuple_GET_ITEM(sequence, 3);
4183 __pyx_t_12 = PyTuple_GET_ITEM(sequence, 4);
4184 __pyx_t_11 = PyTuple_GET_ITEM(sequence, 5);
4185 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 6);
4186 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 7);
4187 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 8);
4188 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 9);
4189 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 10);
4191 __pyx_t_16 = PyList_GET_ITEM(sequence, 0);
4192 __pyx_t_14 = PyList_GET_ITEM(sequence, 1);
4193 __pyx_t_15 = PyList_GET_ITEM(sequence, 2);
4194 __pyx_t_13 = PyList_GET_ITEM(sequence, 3);
4195 __pyx_t_12 = PyList_GET_ITEM(sequence, 4);
4196 __pyx_t_11 = PyList_GET_ITEM(sequence, 5);
4197 __pyx_t_10 = PyList_GET_ITEM(sequence, 6);
4198 __pyx_t_6 = PyList_GET_ITEM(sequence, 7);
4199 __pyx_t_3 = PyList_GET_ITEM(sequence, 8);
4200 __pyx_t_2 = PyList_GET_ITEM(sequence, 9);
4201 __pyx_t_5 = PyList_GET_ITEM(sequence, 10);
4203 __Pyx_INCREF(__pyx_t_16);
4204 __Pyx_INCREF(__pyx_t_14);
4205 __Pyx_INCREF(__pyx_t_15);
4206 __Pyx_INCREF(__pyx_t_13);
4207 __Pyx_INCREF(__pyx_t_12);
4208 __Pyx_INCREF(__pyx_t_11);
4209 __Pyx_INCREF(__pyx_t_10);
4210 __Pyx_INCREF(__pyx_t_6);
4211 __Pyx_INCREF(__pyx_t_3);
4212 __Pyx_INCREF(__pyx_t_2);
4213 __Pyx_INCREF(__pyx_t_5);
4217 PyObject** temps[11] = {&__pyx_t_16,&__pyx_t_14,&__pyx_t_15,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_6,&__pyx_t_3,&__pyx_t_2,&__pyx_t_5};
4218 for (i=0; i < 11; i++) {
4219 PyObject* item = PySequence_ITEM(sequence, i);
if (unlikely(!item)) __PYX_ERR(0, 652, __pyx_L1_error)
4225 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4227 Py_ssize_t index = -1;
4228 PyObject** temps[11] = {&__pyx_t_16,&__pyx_t_14,&__pyx_t_15,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_6,&__pyx_t_3,&__pyx_t_2,&__pyx_t_5};
4229 __pyx_t_17 = PyObject_GetIter(__pyx_t_1);
if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 652, __pyx_L1_error)
4230 __Pyx_GOTREF(__pyx_t_17);
4231 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4232 __pyx_t_7 = Py_TYPE(__pyx_t_17)->tp_iternext;
4233 for (index=0; index < 11; index++) {
4234 PyObject* item = __pyx_t_7(__pyx_t_17);
if (unlikely(!item))
goto __pyx_L12_unpacking_failed;
4236 *(temps[index]) = item;
4238 if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_17), 11) < 0) __PYX_ERR(0, 652, __pyx_L1_error)
4240 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4241 goto __pyx_L13_unpacking_done;
4242 __pyx_L12_unpacking_failed:;
4243 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4245 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4246 __PYX_ERR(0, 652, __pyx_L1_error)
4247 __pyx_L13_unpacking_done:;
4257 __Pyx_TraceLine(652,0,__PYX_ERR(0, 652, __pyx_L1_error))
4258 __pyx_v_trace = __pyx_t_16;
4260 __pyx_v_error = __pyx_t_14;
4262 __pyx_v_num_outliers = __pyx_t_15;
4264 __pyx_v_samples = __pyx_t_13;
4266 __pyx_v_processed_samples_indices = __pyx_t_12;
4268 __pyx_v_num_processed_samples = __pyx_t_11;
4270 __pyx_v_num_samples_used = __pyx_t_10;
4272 __pyx_v_converged = __pyx_t_6;
4274 __pyx_v_tot_wall_time = __pyx_t_3;
4276 __pyx_v_alg_wall_time = __pyx_t_2;
4278 __pyx_v_cpu_proc_time = __pyx_t_5;
4298 __Pyx_TraceLine(663,0,__PYX_ERR(0, 663, __pyx_L1_error))
4300 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
4301 __Pyx_GOTREF(__pyx_t_1);
4302 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4303 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4304 __PYX_ERR(0, 663, __pyx_L1_error)
4315 __Pyx_TraceLine(667,0,__PYX_ERR(0, 667, __pyx_L1_error))
4316 __pyx_t_1 = __Pyx_PyDict_NewPresized(6);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error)
4317 __Pyx_GOTREF(__pyx_t_1);
4326 __Pyx_TraceLine(669,0,__PYX_ERR(0, 669, __pyx_L1_error))
4327 __pyx_t_5 = __Pyx_PyDict_NewPresized(9);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 669, __pyx_L1_error)
4328 __Pyx_GOTREF(__pyx_t_5);
4329 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_data_type, __pyx_v_data_type_name) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4338 __Pyx_TraceLine(670,0,__PYX_ERR(0, 670, __pyx_L1_error))
4339 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_gram, __pyx_v_gram) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4348 __Pyx_TraceLine(671,0,__PYX_ERR(0, 671, __pyx_L1_error))
4349 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_exponent, __pyx_v_p) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4358 __Pyx_TraceLine(672,0,__PYX_ERR(0, 672, __pyx_L1_error))
4359 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_assume_matrix, __pyx_v_assume_matrix) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4368 __Pyx_TraceLine(673,0,__PYX_ERR(0, 673, __pyx_L1_error))
4369 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 673, __pyx_L1_error)
4370 __Pyx_GOTREF(__pyx_t_2);
4371 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_size, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4372 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4381 __Pyx_TraceLine(674,0,__PYX_ERR(0, 674, __pyx_L1_error))
4382 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_isspmatrix);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 674, __pyx_L1_error)
4383 __Pyx_GOTREF(__pyx_t_3);
4385 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4386 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
4387 if (likely(__pyx_t_6)) {
4388 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
4389 __Pyx_INCREF(__pyx_t_6);
4390 __Pyx_INCREF(
function);
4391 __Pyx_DECREF_SET(__pyx_t_3,
function);
4394 __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_A);
4395 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4396 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 674, __pyx_L1_error)
4397 __Pyx_GOTREF(__pyx_t_2);
4398 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4399 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_sparse, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4400 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4409 __Pyx_TraceLine(675,0,__PYX_ERR(0, 675, __pyx_L1_error))
4410 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_nnz);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error)
4411 __Pyx_GOTREF(__pyx_t_3);
4413 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4414 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
4415 if (likely(__pyx_t_6)) {
4416 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
4417 __Pyx_INCREF(__pyx_t_6);
4418 __Pyx_INCREF(
function);
4419 __Pyx_DECREF_SET(__pyx_t_3,
function);
4422 __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_A);
4423 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4424 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 675, __pyx_L1_error)
4425 __Pyx_GOTREF(__pyx_t_2);
4426 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4427 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_nnz, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4428 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4437 __Pyx_TraceLine(676,0,__PYX_ERR(0, 676, __pyx_L1_error))
4438 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_density);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error)
4439 __Pyx_GOTREF(__pyx_t_3);
4441 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4442 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
4443 if (likely(__pyx_t_6)) {
4444 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
4445 __Pyx_INCREF(__pyx_t_6);
4446 __Pyx_INCREF(
function);
4447 __Pyx_DECREF_SET(__pyx_t_3,
function);
4450 __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_A);
4451 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4452 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error)
4453 __Pyx_GOTREF(__pyx_t_2);
4454 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4455 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_density, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4456 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4457 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_inquiries, __pyx_int_1) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4458 if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_matrix, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4459 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4468 __Pyx_TraceLine(681,0,__PYX_ERR(0, 681, __pyx_L1_error))
4469 __pyx_t_5 = __Pyx_PyDict_NewPresized(6);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 681, __pyx_L1_error)
4470 __Pyx_GOTREF(__pyx_t_5);
4471 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_absolute_error, __pyx_v_error) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4480 __Pyx_TraceLine(683,0,__PYX_ERR(0, 683, __pyx_L1_error))
4481 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error)
4482 __Pyx_GOTREF(__pyx_t_3);
4483 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_abs);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 683, __pyx_L1_error)
4484 __Pyx_GOTREF(__pyx_t_6);
4485 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4487 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
4488 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
4489 if (likely(__pyx_t_3)) {
4490 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
4491 __Pyx_INCREF(__pyx_t_3);
4492 __Pyx_INCREF(
function);
4493 __Pyx_DECREF_SET(__pyx_t_6,
function);
4496 __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_v_trace) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_trace);
4497 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4498 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 683, __pyx_L1_error)
4499 __Pyx_GOTREF(__pyx_t_2);
4500 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4501 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error)
4502 __Pyx_GOTREF(__pyx_t_3);
4503 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_finfo);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 683, __pyx_L1_error)
4504 __Pyx_GOTREF(__pyx_t_10);
4505 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4507 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
4508 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
4509 if (likely(__pyx_t_3)) {
4510 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_10);
4511 __Pyx_INCREF(__pyx_t_3);
4512 __Pyx_INCREF(
function);
4513 __Pyx_DECREF_SET(__pyx_t_10,
function);
4516 __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_3, ((PyObject *)(&PyFloat_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_10, ((PyObject *)(&PyFloat_Type)));
4517 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4518 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 683, __pyx_L1_error)
4519 __Pyx_GOTREF(__pyx_t_6);
4520 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4521 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_eps);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 683, __pyx_L1_error)
4522 __Pyx_GOTREF(__pyx_t_10);
4523 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4524 __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_10);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 683, __pyx_L1_error)
4525 __Pyx_GOTREF(__pyx_t_6);
4526 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4527 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4528 __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_v_error, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 683, __pyx_L1_error)
4529 __Pyx_GOTREF(__pyx_t_10);
4530 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4531 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_relative_error, __pyx_t_10) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4532 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4541 __Pyx_TraceLine(684,0,__PYX_ERR(0, 684, __pyx_L1_error))
4542 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_error_atol, __pyx_v_error_atol) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4551 __Pyx_TraceLine(685,0,__PYX_ERR(0, 685, __pyx_L1_error))
4552 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_error_rtol, __pyx_v_error_rtol) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4561 __Pyx_TraceLine(686,0,__PYX_ERR(0, 686, __pyx_L1_error))
4562 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_confidence_level, __pyx_v_confidence_level) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4571 __Pyx_TraceLine(687,0,__PYX_ERR(0, 687, __pyx_L1_error))
4572 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_outlier_significance_level, __pyx_v_outlier_significance_level) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4573 if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_error, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4574 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4583 __Pyx_TraceLine(691,0,__PYX_ERR(0, 691, __pyx_L1_error))
4584 __pyx_t_5 = __Pyx_PyDict_NewPresized(8);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 691, __pyx_L1_error)
4585 __Pyx_GOTREF(__pyx_t_5);
4586 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_converged);
if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 691, __pyx_L1_error)
4587 __pyx_t_10 = __Pyx_PyBool_FromLong((!(!__pyx_t_9)));
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 691, __pyx_L1_error)
4588 __Pyx_GOTREF(__pyx_t_10);
4589 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_converged, __pyx_t_10) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4590 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4599 __Pyx_TraceLine(692,0,__PYX_ERR(0, 692, __pyx_L1_error))
4600 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_min_num_samples, __pyx_v_min_num_samples) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4609 __Pyx_TraceLine(693,0,__PYX_ERR(0, 693, __pyx_L1_error))
4610 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_max_num_samples, __pyx_v_max_num_samples) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4619 __Pyx_TraceLine(694,0,__PYX_ERR(0, 694, __pyx_L1_error))
4620 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_samples_used, __pyx_v_num_samples_used) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4629 __Pyx_TraceLine(695,0,__PYX_ERR(0, 695, __pyx_L1_error))
4630 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_outliers, __pyx_v_num_outliers) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4639 __Pyx_TraceLine(696,0,__PYX_ERR(0, 696, __pyx_L1_error))
4640 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_samples, __pyx_v_samples) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4649 __Pyx_TraceLine(697,0,__PYX_ERR(0, 697, __pyx_L1_error))
4650 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_samples_mean, __pyx_v_trace) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4659 __Pyx_TraceLine(698,0,__PYX_ERR(0, 698, __pyx_L1_error))
4660 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_samples_processed_order, __pyx_v_processed_samples_indices) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4661 if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_convergence, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4662 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4671 __Pyx_TraceLine(702,0,__PYX_ERR(0, 702, __pyx_L1_error))
4672 __pyx_t_5 = __Pyx_PyDict_NewPresized(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L1_error)
4673 __Pyx_GOTREF(__pyx_t_5);
4674 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_cpu_threads, __pyx_v_num_threads) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
4675 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_gpu_devices, __pyx_int_0) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
4676 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_gpu_multiprocessors, __pyx_int_0) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
4677 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_gpu_threads_per_multiprocess, __pyx_int_0) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
4678 if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_device, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4679 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4688 __Pyx_TraceLine(709,0,__PYX_ERR(0, 709, __pyx_L1_error))
4689 __pyx_t_5 = __Pyx_PyDict_NewPresized(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 709, __pyx_L1_error)
4690 __Pyx_GOTREF(__pyx_t_5);
4691 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_tot_wall_time, __pyx_v_tot_wall_time) < 0) __PYX_ERR(0, 709, __pyx_L1_error)
4700 __Pyx_TraceLine(710,0,__PYX_ERR(0, 710, __pyx_L1_error))
4701 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_alg_wall_time, __pyx_v_alg_wall_time) < 0) __PYX_ERR(0, 709, __pyx_L1_error)
4710 __Pyx_TraceLine(711,0,__PYX_ERR(0, 711, __pyx_L1_error))
4711 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_cpu_proc_time, __pyx_v_cpu_proc_time) < 0) __PYX_ERR(0, 709, __pyx_L1_error)
4712 if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_time, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4713 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4722 __Pyx_TraceLine(715,0,__PYX_ERR(0, 715, __pyx_L1_error))
4723 __pyx_t_5 = __Pyx_PyDict_NewPresized(5);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L1_error)
4724 __Pyx_GOTREF(__pyx_t_5);
4725 __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_version_2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 715, __pyx_L1_error)
4726 __Pyx_GOTREF(__pyx_t_10);
4727 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_version, __pyx_t_10) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4728 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4737 __Pyx_TraceLine(716,0,__PYX_ERR(0, 716, __pyx_L1_error))
4738 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_orthogonalize, __pyx_v_orthogonalize) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4747 __Pyx_TraceLine(717,0,__PYX_ERR(0, 717, __pyx_L1_error))
4748 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_seed, __pyx_v_seed) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4757 __Pyx_TraceLine(718,0,__PYX_ERR(0, 718, __pyx_L1_error))
4758 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_solver_tol, __pyx_v_solver_tol) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4759 if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_method, __pyx_n_u_hutchinson) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4760 if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_solver, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4761 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4762 __pyx_v_info = ((PyObject*)__pyx_t_1);
4772 __Pyx_TraceLine(724,0,__PYX_ERR(0, 724, __pyx_L1_error))
4773 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_verbose);
if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 724, __pyx_L1_error)
4783 __Pyx_TraceLine(725,0,__PYX_ERR(0, 725, __pyx_L1_error))
4784 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_print_summary);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 725, __pyx_L1_error)
4785 __Pyx_GOTREF(__pyx_t_5);
4787 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4788 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
4789 if (likely(__pyx_t_10)) {
4790 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
4791 __Pyx_INCREF(__pyx_t_10);
4792 __Pyx_INCREF(
function);
4793 __Pyx_DECREF_SET(__pyx_t_5,
function);
4796 __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_v_info) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_info);
4797 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4798 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
4799 __Pyx_GOTREF(__pyx_t_1);
4800 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4801 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4819 __Pyx_TraceLine(728,0,__PYX_ERR(0, 728, __pyx_L1_error))
4820 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_plot);
if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 728, __pyx_L1_error)
4830 __Pyx_TraceLine(729,0,__PYX_ERR(0, 729, __pyx_L1_error))
4831 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_plot_convergence);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 729, __pyx_L1_error)
4832 __Pyx_GOTREF(__pyx_t_5);
4834 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4835 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
4836 if (likely(__pyx_t_10)) {
4837 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
4838 __Pyx_INCREF(__pyx_t_10);
4839 __Pyx_INCREF(
function);
4840 __Pyx_DECREF_SET(__pyx_t_5,
function);
4843 __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_v_info) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_info);
4844 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4845 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error)
4846 __Pyx_GOTREF(__pyx_t_1);
4847 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4848 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4866 __Pyx_TraceLine(731,0,__PYX_ERR(0, 731, __pyx_L1_error))
4867 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_return_info);
if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 731, __pyx_L1_error)
4877 __Pyx_TraceLine(732,0,__PYX_ERR(0, 732, __pyx_L1_error))
4878 __Pyx_XDECREF(__pyx_r);
4879 __pyx_t_1 = PyTuple_New(2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
4880 __Pyx_GOTREF(__pyx_t_1);
4881 __Pyx_INCREF(__pyx_v_trace);
4882 __Pyx_GIVEREF(__pyx_v_trace);
4883 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_trace);
4884 __Pyx_INCREF(__pyx_v_info);
4885 __Pyx_GIVEREF(__pyx_v_info);
4886 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_info);
4887 __pyx_r = __pyx_t_1;
4907 __Pyx_TraceLine(734,0,__PYX_ERR(0, 734, __pyx_L1_error))
4909 __Pyx_XDECREF(__pyx_r);
4910 __Pyx_INCREF(__pyx_v_trace);
4911 __pyx_r = __pyx_v_trace;
4925 __Pyx_XDECREF(__pyx_t_1);
4926 __Pyx_XDECREF(__pyx_t_2);
4927 __Pyx_XDECREF(__pyx_t_3);
4928 __Pyx_XDECREF(__pyx_t_5);
4929 __Pyx_XDECREF(__pyx_t_6);
4930 __Pyx_XDECREF(__pyx_t_10);
4931 __Pyx_XDECREF(__pyx_t_11);
4932 __Pyx_XDECREF(__pyx_t_12);
4933 __Pyx_XDECREF(__pyx_t_13);
4934 __Pyx_XDECREF(__pyx_t_14);
4935 __Pyx_XDECREF(__pyx_t_15);
4936 __Pyx_XDECREF(__pyx_t_16);
4937 __Pyx_XDECREF(__pyx_t_17);
4938 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method.hutchinson_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
4941 __Pyx_XDECREF(__pyx_v_square);
4942 __Pyx_XDECREF(__pyx_v_data_type_name);
4943 __Pyx_XDECREF(__pyx_v_trace);
4944 __Pyx_XDECREF(__pyx_v_error);
4945 __Pyx_XDECREF(__pyx_v_num_outliers);
4946 __Pyx_XDECREF(__pyx_v_samples);
4947 __Pyx_XDECREF(__pyx_v_processed_samples_indices);
4948 __Pyx_XDECREF(__pyx_v_num_processed_samples);
4949 __Pyx_XDECREF(__pyx_v_num_samples_used);
4950 __Pyx_XDECREF(__pyx_v_converged);
4951 __Pyx_XDECREF(__pyx_v_tot_wall_time);
4952 __Pyx_XDECREF(__pyx_v_alg_wall_time);
4953 __Pyx_XDECREF(__pyx_v_cpu_proc_time);
4954 __Pyx_XDECREF(__pyx_v_info);
4955 __Pyx_XDECREF(__pyx_v_min_num_samples);
4956 __Pyx_XDECREF(__pyx_v_max_num_samples);
4957 __Pyx_XDECREF(__pyx_v_error_atol);
4958 __Pyx_XDECREF(__pyx_v_error_rtol);
4959 __Pyx_XDECREF(__pyx_v_seed);
4960 __Pyx_XDECREF(__pyx_v_num_threads);
4961 __Pyx_XGIVEREF(__pyx_r);
4962 __Pyx_TraceReturn(__pyx_r, 0);
4963 __Pyx_RefNannyFinishContext();
4976 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4977 static char __pyx_doc_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float[] =
"_hutchinson_method_float(A, B, C, gram, p, assume_matrix, min_num_samples, max_num_samples, error_atol, error_rtol, confidence_level, outlier_significance_level, solver_tol, orthogonalize, seed, num_threads)\n\n This method processes single precision (32-bit) matrix ``A``.\n ";
4978 static PyMethodDef __pyx_mdef_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float = {
"_hutchinson_method_float", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float};
4979 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4980 PyObject *__pyx_v_A = 0;
4981 PyObject *__pyx_v_B = 0;
4982 PyObject *__pyx_v_C = 0;
4983 PyObject *__pyx_v_gram = 0;
4984 PyObject *__pyx_v_p = 0;
4985 PyObject *__pyx_v_assume_matrix = 0;
4986 PyObject *__pyx_v_min_num_samples = 0;
4987 PyObject *__pyx_v_max_num_samples = 0;
4988 PyObject *__pyx_v_error_atol = 0;
4989 PyObject *__pyx_v_error_rtol = 0;
4990 PyObject *__pyx_v_confidence_level = 0;
4991 PyObject *__pyx_v_outlier_significance_level = 0;
4992 PyObject *__pyx_v_solver_tol = 0;
4993 PyObject *__pyx_v_orthogonalize = 0;
4994 PyObject *__pyx_v_seed = 0;
4995 PyObject *__pyx_v_num_threads = 0;
4996 int __pyx_lineno = 0;
4997 const char *__pyx_filename = NULL;
4998 int __pyx_clineno = 0;
4999 PyObject *__pyx_r = 0;
5000 __Pyx_RefNannyDeclarations
5001 __Pyx_RefNannySetupContext(
"_hutchinson_method_float (wrapper)", 0);
5003 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_gram,&__pyx_n_s_p,&__pyx_n_s_assume_matrix,&__pyx_n_s_min_num_samples,&__pyx_n_s_max_num_samples,&__pyx_n_s_error_atol,&__pyx_n_s_error_rtol,&__pyx_n_s_confidence_level,&__pyx_n_s_outlier_significance_level,&__pyx_n_s_solver_tol,&__pyx_n_s_orthogonalize,&__pyx_n_s_seed,&__pyx_n_s_num_threads,0};
5004 PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
5005 if (unlikely(__pyx_kwds)) {
5007 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5009 case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
5011 case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
5013 case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
5015 case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
5017 case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
5019 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
5021 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
5023 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5025 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5027 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5029 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5031 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5033 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5035 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5037 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5039 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5042 default:
goto __pyx_L5_argtuple_error;
5044 kw_args = PyDict_Size(__pyx_kwds);
5047 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
5048 else goto __pyx_L5_argtuple_error;
5051 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
5053 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 1); __PYX_ERR(0, 741, __pyx_L3_error)
5057 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
5059 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 2); __PYX_ERR(0, 741, __pyx_L3_error)
5063 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gram)) != 0)) kw_args--;
5065 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 3); __PYX_ERR(0, 741, __pyx_L3_error)
5069 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
5071 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 4); __PYX_ERR(0, 741, __pyx_L3_error)
5075 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_assume_matrix)) != 0)) kw_args--;
5077 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 5); __PYX_ERR(0, 741, __pyx_L3_error)
5081 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_num_samples)) != 0)) kw_args--;
5083 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 6); __PYX_ERR(0, 741, __pyx_L3_error)
5087 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_num_samples)) != 0)) kw_args--;
5089 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 7); __PYX_ERR(0, 741, __pyx_L3_error)
5093 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_atol)) != 0)) kw_args--;
5095 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 8); __PYX_ERR(0, 741, __pyx_L3_error)
5099 if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_rtol)) != 0)) kw_args--;
5101 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 9); __PYX_ERR(0, 741, __pyx_L3_error)
5105 if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_confidence_level)) != 0)) kw_args--;
5107 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 10); __PYX_ERR(0, 741, __pyx_L3_error)
5111 if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outlier_significance_level)) != 0)) kw_args--;
5113 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 11); __PYX_ERR(0, 741, __pyx_L3_error)
5117 if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_solver_tol)) != 0)) kw_args--;
5119 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 12); __PYX_ERR(0, 741, __pyx_L3_error)
5123 if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_orthogonalize)) != 0)) kw_args--;
5125 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 13); __PYX_ERR(0, 741, __pyx_L3_error)
5129 if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed)) != 0)) kw_args--;
5131 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 14); __PYX_ERR(0, 741, __pyx_L3_error)
5135 if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--;
5137 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, 15); __PYX_ERR(0, 741, __pyx_L3_error)
5140 if (unlikely(kw_args > 0)) {
5141 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"_hutchinson_method_float") < 0)) __PYX_ERR(0, 741, __pyx_L3_error)
5143 }
else if (PyTuple_GET_SIZE(__pyx_args) != 16) {
5144 goto __pyx_L5_argtuple_error;
5146 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5147 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5148 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5149 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5150 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5151 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5152 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5153 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5154 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5155 values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
5156 values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
5157 values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
5158 values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
5159 values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
5160 values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
5161 values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
5163 __pyx_v_A = values[0];
5164 __pyx_v_B = values[1];
5165 __pyx_v_C = values[2];
5166 __pyx_v_gram = values[3];
5167 __pyx_v_p = values[4];
5168 __pyx_v_assume_matrix = values[5];
5169 __pyx_v_min_num_samples = values[6];
5170 __pyx_v_max_num_samples = values[7];
5171 __pyx_v_error_atol = values[8];
5172 __pyx_v_error_rtol = values[9];
5173 __pyx_v_confidence_level = values[10];
5174 __pyx_v_outlier_significance_level = values[11];
5175 __pyx_v_solver_tol = values[12];
5176 __pyx_v_orthogonalize = values[13];
5177 __pyx_v_seed = values[14];
5178 __pyx_v_num_threads = values[15];
5180 goto __pyx_L4_argument_unpacking_done;
5181 __pyx_L5_argtuple_error:;
5182 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_float", 1, 16, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 741, __pyx_L3_error)
5184 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method._hutchinson_method_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
5185 __Pyx_RefNannyFinishContext();
5187 __pyx_L4_argument_unpacking_done:;
5188 __pyx_r = __pyx_pf_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float(__pyx_self, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads);
5191 __Pyx_RefNannyFinishContext();
5195 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads) {
5196 PyObject *__pyx_v_vector_size = NULL;
5197 PyObject *__pyx_v_E = NULL;
5198 __Pyx_memviewslice __pyx_v_memoryview_E = { 0, 0, { 0 }, { 0 }, { 0 } };
5200 PyObject *__pyx_v_init_tot_wall_time = NULL;
5201 PyObject *__pyx_v_init_cpu_proc_time = NULL;
5202 PyObject *__pyx_v_samples = NULL;
5203 PyObject *__pyx_v_processed_samples_indices = NULL;
5204 int __pyx_v_num_processed_samples;
5205 int __pyx_v_num_samples_used;
5206 int __pyx_v_converged;
5207 PyObject *__pyx_v_init_alg_wall_time = NULL;
5208 PyObject *__pyx_v_AtA = NULL;
5209 PyObject *__pyx_v_i = NULL;
5210 PyObject *__pyx_v_alg_wall_time = NULL;
5211 PyObject *__pyx_v_trace = NULL;
5212 PyObject *__pyx_v_error = NULL;
5213 PyObject *__pyx_v_num_outliers = NULL;
5214 PyObject *__pyx_v_tot_wall_time = NULL;
5215 PyObject *__pyx_v_cpu_proc_time = NULL;
5216 PyObject *__pyx_r = NULL;
5217 __Pyx_TraceDeclarations
5218 __Pyx_RefNannyDeclarations
5219 PyObject *__pyx_t_1 = NULL;
5220 PyObject *__pyx_t_2 = NULL;
5221 PyObject *__pyx_t_3 = NULL;
5222 PyObject *__pyx_t_4 = NULL;
5223 PyObject *__pyx_t_5 = NULL;
5224 __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
5225 Py_ssize_t __pyx_t_7;
5226 Py_ssize_t __pyx_t_8;
5228 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
5229 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
5230 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
5231 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
5235 Py_ssize_t __pyx_t_17;
5236 PyObject *(*__pyx_t_18)(PyObject *);
5239 PyObject *__pyx_t_21 = NULL;
5240 PyObject *(*__pyx_t_22)(PyObject *);
5242 int __pyx_lineno = 0;
5243 const char *__pyx_filename = NULL;
5244 int __pyx_clineno = 0;
5245 __Pyx_TraceFrameInit(__pyx_codeobj__3)
5246 __Pyx_RefNannySetupContext(
"_hutchinson_method_float", 0);
5247 __Pyx_TraceCall(
"_hutchinson_method_float", __pyx_f[0], 741, 0, __PYX_ERR(0, 741, __pyx_L1_error));
5256 __Pyx_TraceLine(762,0,__PYX_ERR(0, 762, __pyx_L1_error))
5257 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
5258 __Pyx_GOTREF(__pyx_t_1);
5259 __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
5260 __Pyx_GOTREF(__pyx_t_2);
5261 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5262 __pyx_v_vector_size = __pyx_t_2;
5272 __Pyx_TraceLine(766,0,__PYX_ERR(0, 766, __pyx_L1_error))
5273 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error)
5274 __Pyx_GOTREF(__pyx_t_2);
5275 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error)
5276 __Pyx_GOTREF(__pyx_t_1);
5277 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5278 __pyx_t_2 = PyTuple_New(2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error)
5279 __Pyx_GOTREF(__pyx_t_2);
5280 __Pyx_INCREF(__pyx_v_vector_size);
5281 __Pyx_GIVEREF(__pyx_v_vector_size);
5282 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_vector_size);
5283 __Pyx_INCREF(__pyx_v_max_num_samples);
5284 __Pyx_GIVEREF(__pyx_v_max_num_samples);
5285 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_max_num_samples);
5286 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 766, __pyx_L1_error)
5287 __Pyx_GOTREF(__pyx_t_3);
5288 __Pyx_GIVEREF(__pyx_t_2);
5289 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
5291 __pyx_t_2 = __Pyx_PyDict_NewPresized(2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error)
5292 __Pyx_GOTREF(__pyx_t_2);
5293 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error)
5294 __Pyx_GOTREF(__pyx_t_4);
5295 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 766, __pyx_L1_error)
5296 __Pyx_GOTREF(__pyx_t_5);
5297 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5298 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 766, __pyx_L1_error)
5299 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5300 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_u_F) < 0) __PYX_ERR(0, 766, __pyx_L1_error)
5301 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 766, __pyx_L1_error)
5302 __Pyx_GOTREF(__pyx_t_5);
5303 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5304 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5305 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5306 __pyx_v_E = __pyx_t_5;
5316 __Pyx_TraceLine(770,0,__PYX_ERR(0, 770, __pyx_L1_error))
5317 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dcd__float(__pyx_v_E, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 770, __pyx_L1_error)
5318 __pyx_v_memoryview_E = __pyx_t_6;
5319 __pyx_t_6.memview = NULL;
5320 __pyx_t_6.data = NULL;
5329 __Pyx_TraceLine(771,0,__PYX_ERR(0, 771, __pyx_L1_error))
5332 __pyx_v_cE = (&(*((
float *) ( (( ((
char *) (((
float *) __pyx_v_memoryview_E.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_memoryview_E.strides[1]) ))));
5341 __Pyx_TraceLine(773,0,__PYX_ERR(0, 773, __pyx_L1_error))
5342 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error)
5343 __Pyx_GOTREF(__pyx_t_2);
5344 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
5345 __Pyx_GOTREF(__pyx_t_3);
5346 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5348 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5349 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
5350 if (likely(__pyx_t_2)) {
5351 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
5352 __Pyx_INCREF(__pyx_t_2);
5353 __Pyx_INCREF(
function);
5354 __Pyx_DECREF_SET(__pyx_t_3,
function);
5357 __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
5358 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5359 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 773, __pyx_L1_error)
5360 __Pyx_GOTREF(__pyx_t_5);
5361 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5362 __pyx_v_init_tot_wall_time = __pyx_t_5;
5372 __Pyx_TraceLine(774,0,__PYX_ERR(0, 774, __pyx_L1_error))
5373 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_time);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error)
5374 __Pyx_GOTREF(__pyx_t_3);
5375 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_process_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
5376 __Pyx_GOTREF(__pyx_t_2);
5377 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5379 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
5380 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5381 if (likely(__pyx_t_3)) {
5382 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
5383 __Pyx_INCREF(__pyx_t_3);
5384 __Pyx_INCREF(
function);
5385 __Pyx_DECREF_SET(__pyx_t_2,
function);
5388 __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5389 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5390 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 774, __pyx_L1_error)
5391 __Pyx_GOTREF(__pyx_t_5);
5392 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5393 __pyx_v_init_cpu_proc_time = __pyx_t_5;
5403 __Pyx_TraceLine(777,0,__PYX_ERR(0, 777, __pyx_L1_error))
5404 __pyx_t_9 = __Pyx_PyInt_As_LongIndexType(__pyx_v_vector_size);
if (unlikely((__pyx_t_9 == ((
LongIndexType)-1)) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error)
5405 __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples);
if (unlikely((__pyx_t_10 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error)
5414 __Pyx_TraceLine(778,0,__PYX_ERR(0, 778, __pyx_L1_error))
5415 __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_orthogonalize);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 778, __pyx_L1_error)
5416 __Pyx_GOTREF(__pyx_t_5);
5417 __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_5);
if (unlikely((__pyx_t_11 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L1_error)
5418 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5419 __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_seed);
if (unlikely((__pyx_t_12 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L1_error)
5428 __Pyx_TraceLine(779,0,__PYX_ERR(0, 779, __pyx_L1_error))
5429 __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_num_threads);
if (unlikely((__pyx_t_13 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 779, __pyx_L1_error)
5438 __Pyx_TraceLine(777,0,__PYX_ERR(0, 777, __pyx_L1_error))
5439 __pyx_fuse_0__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors(__pyx_v_cE, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13);
5448 __Pyx_TraceLine(781,0,__PYX_ERR(0, 781, __pyx_L1_error))
5449 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 781, __pyx_L1_error)
5450 __Pyx_GOTREF(__pyx_t_5);
5451 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 781, __pyx_L1_error)
5452 __Pyx_GOTREF(__pyx_t_2);
5453 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5454 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 781, __pyx_L1_error)
5455 __Pyx_GOTREF(__pyx_t_5);
5456 __Pyx_INCREF(__pyx_v_max_num_samples);
5457 __Pyx_GIVEREF(__pyx_v_max_num_samples);
5458 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_max_num_samples);
5459 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 781, __pyx_L1_error)
5460 __Pyx_GOTREF(__pyx_t_3);
5461 __Pyx_GIVEREF(__pyx_t_5);
5462 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
5464 __pyx_t_5 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 781, __pyx_L1_error)
5465 __Pyx_GOTREF(__pyx_t_5);
5466 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error)
5467 __Pyx_GOTREF(__pyx_t_1);
5468 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L1_error)
5469 __Pyx_GOTREF(__pyx_t_4);
5470 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5471 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 781, __pyx_L1_error)
5472 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5473 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L1_error)
5474 __Pyx_GOTREF(__pyx_t_4);
5475 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5476 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5477 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5478 __pyx_v_samples = __pyx_t_4;
5488 __Pyx_TraceLine(782,0,__PYX_ERR(0, 782, __pyx_L1_error))
5489 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error)
5490 __Pyx_GOTREF(__pyx_t_4);
5491 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 782, __pyx_L1_error)
5492 __Pyx_GOTREF(__pyx_t_5);
5493 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5494 __pyx_t_4 = PyTuple_New(1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error)
5495 __Pyx_GOTREF(__pyx_t_4);
5496 __Pyx_INCREF(__pyx_v_max_num_samples);
5497 __Pyx_GIVEREF(__pyx_v_max_num_samples);
5498 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_max_num_samples);
5499 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __pyx_L1_error)
5500 __Pyx_GOTREF(__pyx_t_3);
5501 __Pyx_GIVEREF(__pyx_t_4);
5502 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
5504 __pyx_t_4 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error)
5505 __Pyx_GOTREF(__pyx_t_4);
5506 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 782, __pyx_L1_error)
5507 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
5508 __Pyx_GOTREF(__pyx_t_2);
5509 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5510 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5511 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5512 __pyx_v_processed_samples_indices = __pyx_t_2;
5522 __Pyx_TraceLine(783,0,__PYX_ERR(0, 783, __pyx_L1_error))
5523 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 783, __pyx_L1_error)
5524 __Pyx_GOTREF(__pyx_t_2);
5525 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nan);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 783, __pyx_L1_error)
5526 __Pyx_GOTREF(__pyx_t_4);
5527 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5528 if (__Pyx_PyObject_SetSlice(__pyx_v_samples, __pyx_t_4, 0, 0, NULL, NULL, &__pyx_slice__4, 0, 0, 0) < 0) __PYX_ERR(0, 783, __pyx_L1_error)
5529 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5538 __Pyx_TraceLine(784,0,__PYX_ERR(0, 784, __pyx_L1_error))
5539 __pyx_v_num_processed_samples = 0;
5548 __Pyx_TraceLine(785,0,__PYX_ERR(0, 785, __pyx_L1_error))
5549 __pyx_v_num_samples_used = 0;
5558 __Pyx_TraceLine(786,0,__PYX_ERR(0, 786, __pyx_L1_error))
5559 __pyx_v_converged = 0;
5568 __Pyx_TraceLine(788,0,__PYX_ERR(0, 788, __pyx_L1_error))
5569 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error)
5570 __Pyx_GOTREF(__pyx_t_2);
5571 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error)
5572 __Pyx_GOTREF(__pyx_t_3);
5573 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5575 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5576 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
5577 if (likely(__pyx_t_2)) {
5578 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
5579 __Pyx_INCREF(__pyx_t_2);
5580 __Pyx_INCREF(
function);
5581 __Pyx_DECREF_SET(__pyx_t_3,
function);
5584 __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
5585 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5586 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 788, __pyx_L1_error)
5587 __Pyx_GOTREF(__pyx_t_4);
5588 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5589 __pyx_v_init_alg_wall_time = __pyx_t_4;
5599 __Pyx_TraceLine(791,0,__PYX_ERR(0, 791, __pyx_L1_error))
5600 __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_gram);
if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 791, __pyx_L1_error)
5610 __Pyx_TraceLine(792,0,__PYX_ERR(0, 792, __pyx_L1_error))
5611 __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 792, __pyx_L1_error)
5612 __Pyx_GOTREF(__pyx_t_4);
5613 __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 792, __pyx_L1_error)
5614 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5617 __pyx_t_14 = __pyx_t_15;
5618 goto __pyx_L5_bool_binop_done;
5620 __pyx_t_15 = (__pyx_v_B == Py_None);
5621 __pyx_t_16 = (__pyx_t_15 != 0);
5624 __pyx_t_14 = __pyx_t_16;
5625 goto __pyx_L5_bool_binop_done;
5627 __pyx_t_16 = (__pyx_v_C == Py_None);
5628 __pyx_t_15 = (__pyx_t_16 != 0);
5629 __pyx_t_14 = __pyx_t_15;
5630 __pyx_L5_bool_binop_done:;
5640 __Pyx_TraceLine(794,0,__PYX_ERR(0, 794, __pyx_L1_error))
5641 __Pyx_INCREF(Py_None);
5642 __pyx_v_AtA = Py_None;
5661 __Pyx_TraceLine(796,0,__PYX_ERR(0, 796, __pyx_L1_error))
5663 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_T);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 796, __pyx_L1_error)
5664 __Pyx_GOTREF(__pyx_t_4);
5665 __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_4, __pyx_v_A);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error)
5666 __Pyx_GOTREF(__pyx_t_3);
5667 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5668 __pyx_v_AtA = __pyx_t_3;
5690 __Pyx_TraceLine(798,0,__PYX_ERR(0, 798, __pyx_L1_error))
5692 __Pyx_INCREF(Py_None);
5693 __pyx_v_AtA = Py_None;
5704 __Pyx_TraceLine(801,0,__PYX_ERR(0, 801, __pyx_L1_error))
5705 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_max_num_samples);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
5706 __Pyx_GOTREF(__pyx_t_3);
5707 if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
5708 __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_17 = 0;
5711 __pyx_t_17 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error)
5712 __Pyx_GOTREF(__pyx_t_4);
5713 __pyx_t_18 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 801, __pyx_L1_error)
5715 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5717 if (likely(!__pyx_t_18)) {
5718 if (likely(PyList_CheckExact(__pyx_t_4))) {
5719 if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_4))
break;
5720 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5721 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++;
if (unlikely(0 < 0)) __PYX_ERR(0, 801, __pyx_L1_error)
5723 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_17); __pyx_t_17++;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
5724 __Pyx_GOTREF(__pyx_t_3);
5727 if (__pyx_t_17 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
5728 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5729 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++;
if (unlikely(0 < 0)) __PYX_ERR(0, 801, __pyx_L1_error)
5731 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_17); __pyx_t_17++;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
5732 __Pyx_GOTREF(__pyx_t_3);
5736 __pyx_t_3 = __pyx_t_18(__pyx_t_4);
5737 if (unlikely(!__pyx_t_3)) {
5738 PyObject* exc_type = PyErr_Occurred();
5740 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5741 else __PYX_ERR(0, 801, __pyx_L1_error)
5745 __Pyx_GOTREF(__pyx_t_3);
5747 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
5757 __Pyx_TraceLine(803,0,__PYX_ERR(0, 803, __pyx_L1_error))
5758 __pyx_t_14 = ((__pyx_v_converged == 0) != 0);
5768 __Pyx_TraceLine(807,0,__PYX_ERR(0, 807, __pyx_L1_error))
5769 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 807, __pyx_L1_error)
5770 __Pyx_GOTREF(__pyx_t_3);
5771 __Pyx_INCREF(__pyx_slice__4);
5772 __Pyx_GIVEREF(__pyx_slice__4);
5773 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice__4);
5774 __Pyx_INCREF(__pyx_v_i);
5775 __Pyx_GIVEREF(__pyx_v_i);
5776 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_i);
5777 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_E, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
5778 __Pyx_GOTREF(__pyx_t_2);
5779 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5788 __Pyx_TraceLine(806,0,__PYX_ERR(0, 806, __pyx_L1_error))
5789 __pyx_t_19 = __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_float(__pyx_v_A, __pyx_v_AtA, __pyx_v_B, __pyx_v_C, __pyx_t_2, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_solver_tol);
if (unlikely(__pyx_t_19 == ((
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 806, __pyx_L1_error)
5790 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5791 __pyx_t_2 = PyFloat_FromDouble(__pyx_t_19);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 806, __pyx_L1_error)
5792 __Pyx_GOTREF(__pyx_t_2);
5793 if (unlikely(PyObject_SetItem(__pyx_v_samples, __pyx_v_i, __pyx_t_2) < 0)) __PYX_ERR(0, 806, __pyx_L1_error)
5794 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5803 __Pyx_TraceLine(810,0,__PYX_ERR(0, 810, __pyx_L1_error))
5804 if (unlikely(__Pyx_SetItemInt(__pyx_v_processed_samples_indices, __pyx_v_num_processed_samples, __pyx_v_i,
int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0)) __PYX_ERR(0, 810, __pyx_L1_error)
5813 __Pyx_TraceLine(811,0,__PYX_ERR(0, 811, __pyx_L1_error))
5814 __pyx_v_num_processed_samples = (__pyx_v_num_processed_samples + 1);
5823 __Pyx_TraceLine(816,0,__PYX_ERR(0, 816, __pyx_L1_error))
5824 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_check_convergence);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 816, __pyx_L1_error)
5825 __Pyx_GOTREF(__pyx_t_3);
5834 __Pyx_TraceLine(818,0,__PYX_ERR(0, 818, __pyx_L1_error))
5835 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_num_processed_samples);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 818, __pyx_L1_error)
5836 __Pyx_GOTREF(__pyx_t_5);
5845 __Pyx_TraceLine(819,0,__PYX_ERR(0, 819, __pyx_L1_error))
5848 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5849 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
5850 if (likely(__pyx_t_1)) {
5851 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
5852 __Pyx_INCREF(__pyx_t_1);
5853 __Pyx_INCREF(
function);
5854 __Pyx_DECREF_SET(__pyx_t_3,
function);
5858 #if CYTHON_FAST_PYCALL
5859 if (PyFunction_Check(__pyx_t_3)) {
5860 PyObject *__pyx_temp[8] = {__pyx_t_1, __pyx_v_samples, __pyx_v_min_num_samples, __pyx_v_processed_samples_indices, __pyx_t_5, __pyx_v_confidence_level, __pyx_v_error_atol, __pyx_v_error_rtol};
5861 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 7+__pyx_t_20);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error)
5862 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5863 __Pyx_GOTREF(__pyx_t_2);
5864 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5867 #if CYTHON_FAST_PYCCALL
5868 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
5869 PyObject *__pyx_temp[8] = {__pyx_t_1, __pyx_v_samples, __pyx_v_min_num_samples, __pyx_v_processed_samples_indices, __pyx_t_5, __pyx_v_confidence_level, __pyx_v_error_atol, __pyx_v_error_rtol};
5870 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 7+__pyx_t_20);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error)
5871 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5872 __Pyx_GOTREF(__pyx_t_2);
5873 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5877 __pyx_t_21 = PyTuple_New(7+__pyx_t_20);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 816, __pyx_L1_error)
5878 __Pyx_GOTREF(__pyx_t_21);
5880 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_1); __pyx_t_1 = NULL;
5882 __Pyx_INCREF(__pyx_v_samples);
5883 __Pyx_GIVEREF(__pyx_v_samples);
5884 PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_20, __pyx_v_samples);
5885 __Pyx_INCREF(__pyx_v_min_num_samples);
5886 __Pyx_GIVEREF(__pyx_v_min_num_samples);
5887 PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_20, __pyx_v_min_num_samples);
5888 __Pyx_INCREF(__pyx_v_processed_samples_indices);
5889 __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
5890 PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_20, __pyx_v_processed_samples_indices);
5891 __Pyx_GIVEREF(__pyx_t_5);
5892 PyTuple_SET_ITEM(__pyx_t_21, 3+__pyx_t_20, __pyx_t_5);
5893 __Pyx_INCREF(__pyx_v_confidence_level);
5894 __Pyx_GIVEREF(__pyx_v_confidence_level);
5895 PyTuple_SET_ITEM(__pyx_t_21, 4+__pyx_t_20, __pyx_v_confidence_level);
5896 __Pyx_INCREF(__pyx_v_error_atol);
5897 __Pyx_GIVEREF(__pyx_v_error_atol);
5898 PyTuple_SET_ITEM(__pyx_t_21, 5+__pyx_t_20, __pyx_v_error_atol);
5899 __Pyx_INCREF(__pyx_v_error_rtol);
5900 __Pyx_GIVEREF(__pyx_v_error_rtol);
5901 PyTuple_SET_ITEM(__pyx_t_21, 6+__pyx_t_20, __pyx_v_error_rtol);
5903 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_21, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error)
5904 __Pyx_GOTREF(__pyx_t_2);
5905 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5907 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5908 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
5909 PyObject* sequence = __pyx_t_2;
5910 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
5911 if (unlikely(size != 2)) {
5912 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
5913 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
5914 __PYX_ERR(0, 816, __pyx_L1_error)
5916 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5917 if (likely(PyTuple_CheckExact(sequence))) {
5918 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
5919 __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1);
5921 __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
5922 __pyx_t_21 = PyList_GET_ITEM(sequence, 1);
5924 __Pyx_INCREF(__pyx_t_3);
5925 __Pyx_INCREF(__pyx_t_21);
5927 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 816, __pyx_L1_error)
5928 __Pyx_GOTREF(__pyx_t_3);
5929 __pyx_t_21 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 816, __pyx_L1_error)
5930 __Pyx_GOTREF(__pyx_t_21);
5932 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5934 Py_ssize_t index = -1;
5935 __pyx_t_5 = PyObject_GetIter(__pyx_t_2);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error)
5936 __Pyx_GOTREF(__pyx_t_5);
5937 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5938 __pyx_t_22 = Py_TYPE(__pyx_t_5)->tp_iternext;
5939 index = 0; __pyx_t_3 = __pyx_t_22(__pyx_t_5);
if (unlikely(!__pyx_t_3))
goto __pyx_L11_unpacking_failed;
5940 __Pyx_GOTREF(__pyx_t_3);
5941 index = 1; __pyx_t_21 = __pyx_t_22(__pyx_t_5);
if (unlikely(!__pyx_t_21))
goto __pyx_L11_unpacking_failed;
5942 __Pyx_GOTREF(__pyx_t_21);
5943 if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_5), 2) < 0) __PYX_ERR(0, 816, __pyx_L1_error)
5945 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5946 goto __pyx_L12_unpacking_done;
5947 __pyx_L11_unpacking_failed:;
5948 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5950 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
5951 __PYX_ERR(0, 816, __pyx_L1_error)
5952 __pyx_L12_unpacking_done:;
5962 __Pyx_TraceLine(816,0,__PYX_ERR(0, 816, __pyx_L1_error))
5963 __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_20 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L1_error)
5964 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5965 __pyx_t_23 = __Pyx_PyInt_As_int(__pyx_t_21);
if (unlikely((__pyx_t_23 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L1_error)
5966 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5967 __pyx_v_converged = __pyx_t_20;
5968 __pyx_v_num_samples_used = __pyx_t_23;
5986 __Pyx_TraceLine(801,0,__PYX_ERR(0, 801, __pyx_L1_error))
5988 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5997 __Pyx_TraceLine(821,0,__PYX_ERR(0, 821, __pyx_L1_error))
5998 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
5999 __Pyx_GOTREF(__pyx_t_2);
6000 __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 821, __pyx_L1_error)
6001 __Pyx_GOTREF(__pyx_t_21);
6002 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6004 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
6005 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_21);
6006 if (likely(__pyx_t_2)) {
6007 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_21);
6008 __Pyx_INCREF(__pyx_t_2);
6009 __Pyx_INCREF(
function);
6010 __Pyx_DECREF_SET(__pyx_t_21,
function);
6013 __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_21);
6014 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6015 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error)
6016 __Pyx_GOTREF(__pyx_t_4);
6017 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6018 __pyx_t_21 = PyNumber_Subtract(__pyx_t_4, __pyx_v_init_alg_wall_time);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 821, __pyx_L1_error)
6019 __Pyx_GOTREF(__pyx_t_21);
6020 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6021 __pyx_v_alg_wall_time = __pyx_t_21;
6031 __Pyx_TraceLine(823,0,__PYX_ERR(0, 823, __pyx_L1_error))
6032 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_average_estimates);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 823, __pyx_L1_error)
6033 __Pyx_GOTREF(__pyx_t_4);
6042 __Pyx_TraceLine(825,0,__PYX_ERR(0, 825, __pyx_L1_error))
6043 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_num_samples_used);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error)
6044 __Pyx_GOTREF(__pyx_t_2);
6047 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
6048 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
6049 if (likely(__pyx_t_3)) {
6050 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
6051 __Pyx_INCREF(__pyx_t_3);
6052 __Pyx_INCREF(
function);
6053 __Pyx_DECREF_SET(__pyx_t_4,
function);
6057 #if CYTHON_FAST_PYCALL
6058 if (PyFunction_Check(__pyx_t_4)) {
6059 PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_max_num_samples, __pyx_t_2, __pyx_v_processed_samples_indices, __pyx_v_samples};
6060 __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_23, 6+__pyx_t_23);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 823, __pyx_L1_error)
6061 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6062 __Pyx_GOTREF(__pyx_t_21);
6063 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6066 #if CYTHON_FAST_PYCCALL
6067 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
6068 PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_max_num_samples, __pyx_t_2, __pyx_v_processed_samples_indices, __pyx_v_samples};
6069 __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_23, 6+__pyx_t_23);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 823, __pyx_L1_error)
6070 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6071 __Pyx_GOTREF(__pyx_t_21);
6072 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6076 __pyx_t_5 = PyTuple_New(6+__pyx_t_23);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error)
6077 __Pyx_GOTREF(__pyx_t_5);
6079 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
6081 __Pyx_INCREF(__pyx_v_confidence_level);
6082 __Pyx_GIVEREF(__pyx_v_confidence_level);
6083 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_23, __pyx_v_confidence_level);
6084 __Pyx_INCREF(__pyx_v_outlier_significance_level);
6085 __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
6086 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_23, __pyx_v_outlier_significance_level);
6087 __Pyx_INCREF(__pyx_v_max_num_samples);
6088 __Pyx_GIVEREF(__pyx_v_max_num_samples);
6089 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_23, __pyx_v_max_num_samples);
6090 __Pyx_GIVEREF(__pyx_t_2);
6091 PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_23, __pyx_t_2);
6092 __Pyx_INCREF(__pyx_v_processed_samples_indices);
6093 __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
6094 PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_23, __pyx_v_processed_samples_indices);
6095 __Pyx_INCREF(__pyx_v_samples);
6096 __Pyx_GIVEREF(__pyx_v_samples);
6097 PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_23, __pyx_v_samples);
6099 __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 823, __pyx_L1_error)
6100 __Pyx_GOTREF(__pyx_t_21);
6101 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6103 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6104 if ((likely(PyTuple_CheckExact(__pyx_t_21))) || (PyList_CheckExact(__pyx_t_21))) {
6105 PyObject* sequence = __pyx_t_21;
6106 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6107 if (unlikely(size != 3)) {
6108 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
6109 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6110 __PYX_ERR(0, 823, __pyx_L1_error)
6112 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6113 if (likely(PyTuple_CheckExact(sequence))) {
6114 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
6115 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
6116 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2);
6118 __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
6119 __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
6120 __pyx_t_2 = PyList_GET_ITEM(sequence, 2);
6122 __Pyx_INCREF(__pyx_t_4);
6123 __Pyx_INCREF(__pyx_t_5);
6124 __Pyx_INCREF(__pyx_t_2);
6126 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 823, __pyx_L1_error)
6127 __Pyx_GOTREF(__pyx_t_4);
6128 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error)
6129 __Pyx_GOTREF(__pyx_t_5);
6130 __pyx_t_2 = PySequence_ITEM(sequence, 2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error)
6131 __Pyx_GOTREF(__pyx_t_2);
6133 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6135 Py_ssize_t index = -1;
6136 __pyx_t_3 = PyObject_GetIter(__pyx_t_21);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L1_error)
6137 __Pyx_GOTREF(__pyx_t_3);
6138 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6139 __pyx_t_22 = Py_TYPE(__pyx_t_3)->tp_iternext;
6140 index = 0; __pyx_t_4 = __pyx_t_22(__pyx_t_3);
if (unlikely(!__pyx_t_4))
goto __pyx_L13_unpacking_failed;
6141 __Pyx_GOTREF(__pyx_t_4);
6142 index = 1; __pyx_t_5 = __pyx_t_22(__pyx_t_3);
if (unlikely(!__pyx_t_5))
goto __pyx_L13_unpacking_failed;
6143 __Pyx_GOTREF(__pyx_t_5);
6144 index = 2; __pyx_t_2 = __pyx_t_22(__pyx_t_3);
if (unlikely(!__pyx_t_2))
goto __pyx_L13_unpacking_failed;
6145 __Pyx_GOTREF(__pyx_t_2);
6146 if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_3), 3) < 0) __PYX_ERR(0, 823, __pyx_L1_error)
6148 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6149 goto __pyx_L14_unpacking_done;
6150 __pyx_L13_unpacking_failed:;
6151 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6153 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6154 __PYX_ERR(0, 823, __pyx_L1_error)
6155 __pyx_L14_unpacking_done:;
6165 __Pyx_TraceLine(823,0,__PYX_ERR(0, 823, __pyx_L1_error))
6166 __pyx_v_trace = __pyx_t_4;
6168 __pyx_v_error = __pyx_t_5;
6170 __pyx_v_num_outliers = __pyx_t_2;
6180 __Pyx_TraceLine(827,0,__PYX_ERR(0, 827, __pyx_L1_error))
6181 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error)
6182 __Pyx_GOTREF(__pyx_t_2);
6183 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L1_error)
6184 __Pyx_GOTREF(__pyx_t_5);
6185 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6187 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
6188 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
6189 if (likely(__pyx_t_2)) {
6190 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
6191 __Pyx_INCREF(__pyx_t_2);
6192 __Pyx_INCREF(
function);
6193 __Pyx_DECREF_SET(__pyx_t_5,
function);
6196 __pyx_t_21 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
6197 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6198 if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 827, __pyx_L1_error)
6199 __Pyx_GOTREF(__pyx_t_21);
6200 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6201 __pyx_t_5 = PyNumber_Subtract(__pyx_t_21, __pyx_v_init_tot_wall_time);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L1_error)
6202 __Pyx_GOTREF(__pyx_t_5);
6203 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6204 __pyx_v_tot_wall_time = __pyx_t_5;
6214 __Pyx_TraceLine(828,0,__PYX_ERR(0, 828, __pyx_L1_error))
6215 __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_time);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 828, __pyx_L1_error)
6216 __Pyx_GOTREF(__pyx_t_21);
6217 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_n_s_process_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error)
6218 __Pyx_GOTREF(__pyx_t_2);
6219 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6221 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6222 __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_2);
6223 if (likely(__pyx_t_21)) {
6224 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
6225 __Pyx_INCREF(__pyx_t_21);
6226 __Pyx_INCREF(
function);
6227 __Pyx_DECREF_SET(__pyx_t_2,
function);
6230 __pyx_t_5 = (__pyx_t_21) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_21) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
6231 __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
6232 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 828, __pyx_L1_error)
6233 __Pyx_GOTREF(__pyx_t_5);
6234 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6235 __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_v_init_cpu_proc_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error)
6236 __Pyx_GOTREF(__pyx_t_2);
6237 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6238 __pyx_v_cpu_proc_time = __pyx_t_2;
6248 __Pyx_TraceLine(830,0,__PYX_ERR(0, 830, __pyx_L1_error))
6249 __Pyx_XDECREF(__pyx_r);
6258 __Pyx_TraceLine(831,0,__PYX_ERR(0, 831, __pyx_L1_error))
6259 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_num_processed_samples);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
6260 __Pyx_GOTREF(__pyx_t_2);
6261 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_num_samples_used);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 831, __pyx_L1_error)
6262 __Pyx_GOTREF(__pyx_t_5);
6263 __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_converged);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 831, __pyx_L1_error)
6264 __Pyx_GOTREF(__pyx_t_21);
6273 __Pyx_TraceLine(830,0,__PYX_ERR(0, 830, __pyx_L1_error))
6274 __pyx_t_4 = PyTuple_New(11);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 830, __pyx_L1_error)
6275 __Pyx_GOTREF(__pyx_t_4);
6276 __Pyx_INCREF(__pyx_v_trace);
6277 __Pyx_GIVEREF(__pyx_v_trace);
6278 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_trace);
6279 __Pyx_INCREF(__pyx_v_error);
6280 __Pyx_GIVEREF(__pyx_v_error);
6281 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_error);
6282 __Pyx_INCREF(__pyx_v_num_outliers);
6283 __Pyx_GIVEREF(__pyx_v_num_outliers);
6284 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_num_outliers);
6285 __Pyx_INCREF(__pyx_v_samples);
6286 __Pyx_GIVEREF(__pyx_v_samples);
6287 PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_samples);
6288 __Pyx_INCREF(__pyx_v_processed_samples_indices);
6289 __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
6290 PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_processed_samples_indices);
6291 __Pyx_GIVEREF(__pyx_t_2);
6292 PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_2);
6293 __Pyx_GIVEREF(__pyx_t_5);
6294 PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_t_5);
6295 __Pyx_GIVEREF(__pyx_t_21);
6296 PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_t_21);
6297 __Pyx_INCREF(__pyx_v_tot_wall_time);
6298 __Pyx_GIVEREF(__pyx_v_tot_wall_time);
6299 PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_v_tot_wall_time);
6300 __Pyx_INCREF(__pyx_v_alg_wall_time);
6301 __Pyx_GIVEREF(__pyx_v_alg_wall_time);
6302 PyTuple_SET_ITEM(__pyx_t_4, 9, __pyx_v_alg_wall_time);
6303 __Pyx_INCREF(__pyx_v_cpu_proc_time);
6304 __Pyx_GIVEREF(__pyx_v_cpu_proc_time);
6305 PyTuple_SET_ITEM(__pyx_t_4, 10, __pyx_v_cpu_proc_time);
6309 __pyx_r = __pyx_t_4;
6323 __Pyx_XDECREF(__pyx_t_1);
6324 __Pyx_XDECREF(__pyx_t_2);
6325 __Pyx_XDECREF(__pyx_t_3);
6326 __Pyx_XDECREF(__pyx_t_4);
6327 __Pyx_XDECREF(__pyx_t_5);
6328 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6329 __Pyx_XDECREF(__pyx_t_21);
6330 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method._hutchinson_method_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
6333 __Pyx_XDECREF(__pyx_v_vector_size);
6334 __Pyx_XDECREF(__pyx_v_E);
6335 __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_E, 1);
6336 __Pyx_XDECREF(__pyx_v_init_tot_wall_time);
6337 __Pyx_XDECREF(__pyx_v_init_cpu_proc_time);
6338 __Pyx_XDECREF(__pyx_v_samples);
6339 __Pyx_XDECREF(__pyx_v_processed_samples_indices);
6340 __Pyx_XDECREF(__pyx_v_init_alg_wall_time);
6341 __Pyx_XDECREF(__pyx_v_AtA);
6342 __Pyx_XDECREF(__pyx_v_i);
6343 __Pyx_XDECREF(__pyx_v_alg_wall_time);
6344 __Pyx_XDECREF(__pyx_v_trace);
6345 __Pyx_XDECREF(__pyx_v_error);
6346 __Pyx_XDECREF(__pyx_v_num_outliers);
6347 __Pyx_XDECREF(__pyx_v_tot_wall_time);
6348 __Pyx_XDECREF(__pyx_v_cpu_proc_time);
6349 __Pyx_XGIVEREF(__pyx_r);
6350 __Pyx_TraceReturn(__pyx_r, 0);
6351 __Pyx_RefNannyFinishContext();
6364 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
6365 static char __pyx_doc_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double[] =
"_hutchinson_method_double(A, B, C, gram, p, assume_matrix, min_num_samples, max_num_samples, error_atol, error_rtol, confidence_level, outlier_significance_level, solver_tol, orthogonalize, seed, num_threads)\n\n This method processes double precision (64-bit) matrix ``A``.\n ";
6366 static PyMethodDef __pyx_mdef_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double = {
"_hutchinson_method_double", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double};
6367 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6368 PyObject *__pyx_v_A = 0;
6369 PyObject *__pyx_v_B = 0;
6370 PyObject *__pyx_v_C = 0;
6371 PyObject *__pyx_v_gram = 0;
6372 PyObject *__pyx_v_p = 0;
6373 PyObject *__pyx_v_assume_matrix = 0;
6374 PyObject *__pyx_v_min_num_samples = 0;
6375 PyObject *__pyx_v_max_num_samples = 0;
6376 PyObject *__pyx_v_error_atol = 0;
6377 PyObject *__pyx_v_error_rtol = 0;
6378 PyObject *__pyx_v_confidence_level = 0;
6379 PyObject *__pyx_v_outlier_significance_level = 0;
6380 PyObject *__pyx_v_solver_tol = 0;
6381 PyObject *__pyx_v_orthogonalize = 0;
6382 PyObject *__pyx_v_seed = 0;
6383 PyObject *__pyx_v_num_threads = 0;
6384 int __pyx_lineno = 0;
6385 const char *__pyx_filename = NULL;
6386 int __pyx_clineno = 0;
6387 PyObject *__pyx_r = 0;
6388 __Pyx_RefNannyDeclarations
6389 __Pyx_RefNannySetupContext(
"_hutchinson_method_double (wrapper)", 0);
6391 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_gram,&__pyx_n_s_p,&__pyx_n_s_assume_matrix,&__pyx_n_s_min_num_samples,&__pyx_n_s_max_num_samples,&__pyx_n_s_error_atol,&__pyx_n_s_error_rtol,&__pyx_n_s_confidence_level,&__pyx_n_s_outlier_significance_level,&__pyx_n_s_solver_tol,&__pyx_n_s_orthogonalize,&__pyx_n_s_seed,&__pyx_n_s_num_threads,0};
6392 PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
6393 if (unlikely(__pyx_kwds)) {
6395 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6397 case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
6399 case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
6401 case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
6403 case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
6405 case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
6407 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
6409 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
6411 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
6413 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6415 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6417 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6419 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6421 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6423 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6425 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6427 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6430 default:
goto __pyx_L5_argtuple_error;
6432 kw_args = PyDict_Size(__pyx_kwds);
6435 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
6436 else goto __pyx_L5_argtuple_error;
6439 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
6441 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 1); __PYX_ERR(0, 839, __pyx_L3_error)
6445 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
6447 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 2); __PYX_ERR(0, 839, __pyx_L3_error)
6451 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gram)) != 0)) kw_args--;
6453 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 3); __PYX_ERR(0, 839, __pyx_L3_error)
6457 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
6459 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 4); __PYX_ERR(0, 839, __pyx_L3_error)
6463 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_assume_matrix)) != 0)) kw_args--;
6465 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 5); __PYX_ERR(0, 839, __pyx_L3_error)
6469 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_num_samples)) != 0)) kw_args--;
6471 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 6); __PYX_ERR(0, 839, __pyx_L3_error)
6475 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_num_samples)) != 0)) kw_args--;
6477 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 7); __PYX_ERR(0, 839, __pyx_L3_error)
6481 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_atol)) != 0)) kw_args--;
6483 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 8); __PYX_ERR(0, 839, __pyx_L3_error)
6487 if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_rtol)) != 0)) kw_args--;
6489 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 9); __PYX_ERR(0, 839, __pyx_L3_error)
6493 if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_confidence_level)) != 0)) kw_args--;
6495 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 10); __PYX_ERR(0, 839, __pyx_L3_error)
6499 if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outlier_significance_level)) != 0)) kw_args--;
6501 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 11); __PYX_ERR(0, 839, __pyx_L3_error)
6505 if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_solver_tol)) != 0)) kw_args--;
6507 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 12); __PYX_ERR(0, 839, __pyx_L3_error)
6511 if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_orthogonalize)) != 0)) kw_args--;
6513 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 13); __PYX_ERR(0, 839, __pyx_L3_error)
6517 if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed)) != 0)) kw_args--;
6519 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 14); __PYX_ERR(0, 839, __pyx_L3_error)
6523 if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--;
6525 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, 15); __PYX_ERR(0, 839, __pyx_L3_error)
6528 if (unlikely(kw_args > 0)) {
6529 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"_hutchinson_method_double") < 0)) __PYX_ERR(0, 839, __pyx_L3_error)
6531 }
else if (PyTuple_GET_SIZE(__pyx_args) != 16) {
6532 goto __pyx_L5_argtuple_error;
6534 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6535 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6536 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6537 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6538 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6539 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6540 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6541 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6542 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
6543 values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
6544 values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
6545 values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
6546 values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
6547 values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
6548 values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
6549 values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
6551 __pyx_v_A = values[0];
6552 __pyx_v_B = values[1];
6553 __pyx_v_C = values[2];
6554 __pyx_v_gram = values[3];
6555 __pyx_v_p = values[4];
6556 __pyx_v_assume_matrix = values[5];
6557 __pyx_v_min_num_samples = values[6];
6558 __pyx_v_max_num_samples = values[7];
6559 __pyx_v_error_atol = values[8];
6560 __pyx_v_error_rtol = values[9];
6561 __pyx_v_confidence_level = values[10];
6562 __pyx_v_outlier_significance_level = values[11];
6563 __pyx_v_solver_tol = values[12];
6564 __pyx_v_orthogonalize = values[13];
6565 __pyx_v_seed = values[14];
6566 __pyx_v_num_threads = values[15];
6568 goto __pyx_L4_argument_unpacking_done;
6569 __pyx_L5_argtuple_error:;
6570 __Pyx_RaiseArgtupleInvalid(
"_hutchinson_method_double", 1, 16, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 839, __pyx_L3_error)
6572 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method._hutchinson_method_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
6573 __Pyx_RefNannyFinishContext();
6575 __pyx_L4_argument_unpacking_done:;
6576 __pyx_r = __pyx_pf_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double(__pyx_self, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads);
6579 __Pyx_RefNannyFinishContext();
6583 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads) {
6584 PyObject *__pyx_v_vector_size = NULL;
6585 PyObject *__pyx_v_E = NULL;
6586 __Pyx_memviewslice __pyx_v_memoryview_E = { 0, 0, { 0 }, { 0 }, { 0 } };
6588 PyObject *__pyx_v_init_tot_wall_time = NULL;
6589 PyObject *__pyx_v_init_cpu_proc_time = NULL;
6590 PyObject *__pyx_v_samples = NULL;
6591 PyObject *__pyx_v_processed_samples_indices = NULL;
6592 int __pyx_v_num_processed_samples;
6593 int __pyx_v_num_samples_used;
6594 int __pyx_v_converged;
6595 PyObject *__pyx_v_init_alg_wall_time = NULL;
6596 PyObject *__pyx_v_AtA = NULL;
6597 PyObject *__pyx_v_i = NULL;
6598 PyObject *__pyx_v_alg_wall_time = NULL;
6599 PyObject *__pyx_v_trace = NULL;
6600 PyObject *__pyx_v_error = NULL;
6601 PyObject *__pyx_v_num_outliers = NULL;
6602 PyObject *__pyx_v_tot_wall_time = NULL;
6603 PyObject *__pyx_v_cpu_proc_time = NULL;
6604 PyObject *__pyx_r = NULL;
6605 __Pyx_TraceDeclarations
6606 __Pyx_RefNannyDeclarations
6607 PyObject *__pyx_t_1 = NULL;
6608 PyObject *__pyx_t_2 = NULL;
6609 PyObject *__pyx_t_3 = NULL;
6610 PyObject *__pyx_t_4 = NULL;
6611 PyObject *__pyx_t_5 = NULL;
6612 __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
6613 Py_ssize_t __pyx_t_7;
6614 Py_ssize_t __pyx_t_8;
6616 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
6617 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
6618 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
6619 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
6623 Py_ssize_t __pyx_t_17;
6624 PyObject *(*__pyx_t_18)(PyObject *);
6627 PyObject *__pyx_t_21 = NULL;
6628 PyObject *(*__pyx_t_22)(PyObject *);
6630 int __pyx_lineno = 0;
6631 const char *__pyx_filename = NULL;
6632 int __pyx_clineno = 0;
6633 __Pyx_TraceFrameInit(__pyx_codeobj__5)
6634 __Pyx_RefNannySetupContext(
"_hutchinson_method_double", 0);
6635 __Pyx_TraceCall(
"_hutchinson_method_double", __pyx_f[0], 839, 0, __PYX_ERR(0, 839, __pyx_L1_error));
6644 __Pyx_TraceLine(860,0,__PYX_ERR(0, 860, __pyx_L1_error))
6645 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
6646 __Pyx_GOTREF(__pyx_t_1);
6647 __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 860, __pyx_L1_error)
6648 __Pyx_GOTREF(__pyx_t_2);
6649 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6650 __pyx_v_vector_size = __pyx_t_2;
6660 __Pyx_TraceLine(864,0,__PYX_ERR(0, 864, __pyx_L1_error))
6661 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error)
6662 __Pyx_GOTREF(__pyx_t_2);
6663 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error)
6664 __Pyx_GOTREF(__pyx_t_1);
6665 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6666 __pyx_t_2 = PyTuple_New(2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error)
6667 __Pyx_GOTREF(__pyx_t_2);
6668 __Pyx_INCREF(__pyx_v_vector_size);
6669 __Pyx_GIVEREF(__pyx_v_vector_size);
6670 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_vector_size);
6671 __Pyx_INCREF(__pyx_v_max_num_samples);
6672 __Pyx_GIVEREF(__pyx_v_max_num_samples);
6673 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_max_num_samples);
6674 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 864, __pyx_L1_error)
6675 __Pyx_GOTREF(__pyx_t_3);
6676 __Pyx_GIVEREF(__pyx_t_2);
6677 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
6679 __pyx_t_2 = __Pyx_PyDict_NewPresized(2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error)
6680 __Pyx_GOTREF(__pyx_t_2);
6681 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 864, __pyx_L1_error)
6682 __Pyx_GOTREF(__pyx_t_4);
6683 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 864, __pyx_L1_error)
6684 __Pyx_GOTREF(__pyx_t_5);
6685 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6686 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 864, __pyx_L1_error)
6687 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6688 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_u_F) < 0) __PYX_ERR(0, 864, __pyx_L1_error)
6689 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 864, __pyx_L1_error)
6690 __Pyx_GOTREF(__pyx_t_5);
6691 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6692 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6693 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6694 __pyx_v_E = __pyx_t_5;
6704 __Pyx_TraceLine(868,0,__PYX_ERR(0, 868, __pyx_L1_error))
6705 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dcd__double(__pyx_v_E, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 868, __pyx_L1_error)
6706 __pyx_v_memoryview_E = __pyx_t_6;
6707 __pyx_t_6.memview = NULL;
6708 __pyx_t_6.data = NULL;
6717 __Pyx_TraceLine(869,0,__PYX_ERR(0, 869, __pyx_L1_error))
6720 __pyx_v_cE = (&(*((
double *) ( (( ((
char *) (((
double *) __pyx_v_memoryview_E.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_memoryview_E.strides[1]) ))));
6729 __Pyx_TraceLine(871,0,__PYX_ERR(0, 871, __pyx_L1_error))
6730 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 871, __pyx_L1_error)
6731 __Pyx_GOTREF(__pyx_t_2);
6732 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error)
6733 __Pyx_GOTREF(__pyx_t_3);
6734 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6736 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6737 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
6738 if (likely(__pyx_t_2)) {
6739 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
6740 __Pyx_INCREF(__pyx_t_2);
6741 __Pyx_INCREF(
function);
6742 __Pyx_DECREF_SET(__pyx_t_3,
function);
6745 __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
6746 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6747 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 871, __pyx_L1_error)
6748 __Pyx_GOTREF(__pyx_t_5);
6749 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6750 __pyx_v_init_tot_wall_time = __pyx_t_5;
6760 __Pyx_TraceLine(872,0,__PYX_ERR(0, 872, __pyx_L1_error))
6761 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_time);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L1_error)
6762 __Pyx_GOTREF(__pyx_t_3);
6763 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_process_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 872, __pyx_L1_error)
6764 __Pyx_GOTREF(__pyx_t_2);
6765 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6767 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6768 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6769 if (likely(__pyx_t_3)) {
6770 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
6771 __Pyx_INCREF(__pyx_t_3);
6772 __Pyx_INCREF(
function);
6773 __Pyx_DECREF_SET(__pyx_t_2,
function);
6776 __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
6777 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6778 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 872, __pyx_L1_error)
6779 __Pyx_GOTREF(__pyx_t_5);
6780 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6781 __pyx_v_init_cpu_proc_time = __pyx_t_5;
6791 __Pyx_TraceLine(875,0,__PYX_ERR(0, 875, __pyx_L1_error))
6792 __pyx_t_9 = __Pyx_PyInt_As_LongIndexType(__pyx_v_vector_size);
if (unlikely((__pyx_t_9 == ((
LongIndexType)-1)) && PyErr_Occurred())) __PYX_ERR(0, 875, __pyx_L1_error)
6793 __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples);
if (unlikely((__pyx_t_10 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 875, __pyx_L1_error)
6802 __Pyx_TraceLine(876,0,__PYX_ERR(0, 876, __pyx_L1_error))
6803 __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_orthogonalize);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 876, __pyx_L1_error)
6804 __Pyx_GOTREF(__pyx_t_5);
6805 __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_5);
if (unlikely((__pyx_t_11 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 876, __pyx_L1_error)
6806 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6807 __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_seed);
if (unlikely((__pyx_t_12 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 876, __pyx_L1_error)
6816 __Pyx_TraceLine(877,0,__PYX_ERR(0, 877, __pyx_L1_error))
6817 __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_num_threads);
if (unlikely((__pyx_t_13 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 877, __pyx_L1_error)
6826 __Pyx_TraceLine(875,0,__PYX_ERR(0, 875, __pyx_L1_error))
6827 __pyx_fuse_1__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors(__pyx_v_cE, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13);
6836 __Pyx_TraceLine(879,0,__PYX_ERR(0, 879, __pyx_L1_error))
6837 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error)
6838 __Pyx_GOTREF(__pyx_t_5);
6839 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error)
6840 __Pyx_GOTREF(__pyx_t_2);
6841 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6842 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error)
6843 __Pyx_GOTREF(__pyx_t_5);
6844 __Pyx_INCREF(__pyx_v_max_num_samples);
6845 __Pyx_GIVEREF(__pyx_v_max_num_samples);
6846 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_max_num_samples);
6847 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 879, __pyx_L1_error)
6848 __Pyx_GOTREF(__pyx_t_3);
6849 __Pyx_GIVEREF(__pyx_t_5);
6850 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
6852 __pyx_t_5 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error)
6853 __Pyx_GOTREF(__pyx_t_5);
6854 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error)
6855 __Pyx_GOTREF(__pyx_t_1);
6856 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 879, __pyx_L1_error)
6857 __Pyx_GOTREF(__pyx_t_4);
6858 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6859 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 879, __pyx_L1_error)
6860 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6861 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 879, __pyx_L1_error)
6862 __Pyx_GOTREF(__pyx_t_4);
6863 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6864 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6865 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6866 __pyx_v_samples = __pyx_t_4;
6876 __Pyx_TraceLine(880,0,__PYX_ERR(0, 880, __pyx_L1_error))
6877 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
6878 __Pyx_GOTREF(__pyx_t_4);
6879 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 880, __pyx_L1_error)
6880 __Pyx_GOTREF(__pyx_t_5);
6881 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6882 __pyx_t_4 = PyTuple_New(1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
6883 __Pyx_GOTREF(__pyx_t_4);
6884 __Pyx_INCREF(__pyx_v_max_num_samples);
6885 __Pyx_GIVEREF(__pyx_v_max_num_samples);
6886 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_max_num_samples);
6887 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 880, __pyx_L1_error)
6888 __Pyx_GOTREF(__pyx_t_3);
6889 __Pyx_GIVEREF(__pyx_t_4);
6890 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
6892 __pyx_t_4 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
6893 __Pyx_GOTREF(__pyx_t_4);
6894 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 880, __pyx_L1_error)
6895 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 880, __pyx_L1_error)
6896 __Pyx_GOTREF(__pyx_t_2);
6897 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6898 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6899 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6900 __pyx_v_processed_samples_indices = __pyx_t_2;
6910 __Pyx_TraceLine(881,0,__PYX_ERR(0, 881, __pyx_L1_error))
6911 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error)
6912 __Pyx_GOTREF(__pyx_t_2);
6913 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nan);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 881, __pyx_L1_error)
6914 __Pyx_GOTREF(__pyx_t_4);
6915 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6916 if (__Pyx_PyObject_SetSlice(__pyx_v_samples, __pyx_t_4, 0, 0, NULL, NULL, &__pyx_slice__4, 0, 0, 0) < 0) __PYX_ERR(0, 881, __pyx_L1_error)
6917 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6926 __Pyx_TraceLine(882,0,__PYX_ERR(0, 882, __pyx_L1_error))
6927 __pyx_v_num_processed_samples = 0;
6936 __Pyx_TraceLine(883,0,__PYX_ERR(0, 883, __pyx_L1_error))
6937 __pyx_v_num_samples_used = 0;
6946 __Pyx_TraceLine(884,0,__PYX_ERR(0, 884, __pyx_L1_error))
6947 __pyx_v_converged = 0;
6956 __Pyx_TraceLine(886,0,__PYX_ERR(0, 886, __pyx_L1_error))
6957 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error)
6958 __Pyx_GOTREF(__pyx_t_2);
6959 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __pyx_L1_error)
6960 __Pyx_GOTREF(__pyx_t_3);
6961 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6963 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6964 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
6965 if (likely(__pyx_t_2)) {
6966 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
6967 __Pyx_INCREF(__pyx_t_2);
6968 __Pyx_INCREF(
function);
6969 __Pyx_DECREF_SET(__pyx_t_3,
function);
6972 __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
6973 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6974 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 886, __pyx_L1_error)
6975 __Pyx_GOTREF(__pyx_t_4);
6976 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6977 __pyx_v_init_alg_wall_time = __pyx_t_4;
6987 __Pyx_TraceLine(889,0,__PYX_ERR(0, 889, __pyx_L1_error))
6988 __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_gram);
if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 889, __pyx_L1_error)
6998 __Pyx_TraceLine(890,0,__PYX_ERR(0, 890, __pyx_L1_error))
6999 __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error)
7000 __Pyx_GOTREF(__pyx_t_4);
7001 __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 890, __pyx_L1_error)
7002 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7005 __pyx_t_14 = __pyx_t_15;
7006 goto __pyx_L5_bool_binop_done;
7008 __pyx_t_15 = (__pyx_v_B == Py_None);
7009 __pyx_t_16 = (__pyx_t_15 != 0);
7012 __pyx_t_14 = __pyx_t_16;
7013 goto __pyx_L5_bool_binop_done;
7015 __pyx_t_16 = (__pyx_v_C == Py_None);
7016 __pyx_t_15 = (__pyx_t_16 != 0);
7017 __pyx_t_14 = __pyx_t_15;
7018 __pyx_L5_bool_binop_done:;
7028 __Pyx_TraceLine(892,0,__PYX_ERR(0, 892, __pyx_L1_error))
7029 __Pyx_INCREF(Py_None);
7030 __pyx_v_AtA = Py_None;
7049 __Pyx_TraceLine(894,0,__PYX_ERR(0, 894, __pyx_L1_error))
7051 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_T);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L1_error)
7052 __Pyx_GOTREF(__pyx_t_4);
7053 __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_4, __pyx_v_A);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __pyx_L1_error)
7054 __Pyx_GOTREF(__pyx_t_3);
7055 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7056 __pyx_v_AtA = __pyx_t_3;
7078 __Pyx_TraceLine(896,0,__PYX_ERR(0, 896, __pyx_L1_error))
7080 __Pyx_INCREF(Py_None);
7081 __pyx_v_AtA = Py_None;
7092 __Pyx_TraceLine(899,0,__PYX_ERR(0, 899, __pyx_L1_error))
7093 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_max_num_samples);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
7094 __Pyx_GOTREF(__pyx_t_3);
7095 if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
7096 __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_17 = 0;
7099 __pyx_t_17 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 899, __pyx_L1_error)
7100 __Pyx_GOTREF(__pyx_t_4);
7101 __pyx_t_18 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 899, __pyx_L1_error)
7103 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7105 if (likely(!__pyx_t_18)) {
7106 if (likely(PyList_CheckExact(__pyx_t_4))) {
7107 if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_4))
break;
7108 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7109 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++;
if (unlikely(0 < 0)) __PYX_ERR(0, 899, __pyx_L1_error)
7111 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_17); __pyx_t_17++;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
7112 __Pyx_GOTREF(__pyx_t_3);
7115 if (__pyx_t_17 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
7116 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7117 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++;
if (unlikely(0 < 0)) __PYX_ERR(0, 899, __pyx_L1_error)
7119 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_17); __pyx_t_17++;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
7120 __Pyx_GOTREF(__pyx_t_3);
7124 __pyx_t_3 = __pyx_t_18(__pyx_t_4);
7125 if (unlikely(!__pyx_t_3)) {
7126 PyObject* exc_type = PyErr_Occurred();
7128 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7129 else __PYX_ERR(0, 899, __pyx_L1_error)
7133 __Pyx_GOTREF(__pyx_t_3);
7135 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
7145 __Pyx_TraceLine(901,0,__PYX_ERR(0, 901, __pyx_L1_error))
7146 __pyx_t_14 = ((__pyx_v_converged == 0) != 0);
7156 __Pyx_TraceLine(905,0,__PYX_ERR(0, 905, __pyx_L1_error))
7157 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 905, __pyx_L1_error)
7158 __Pyx_GOTREF(__pyx_t_3);
7159 __Pyx_INCREF(__pyx_slice__4);
7160 __Pyx_GIVEREF(__pyx_slice__4);
7161 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice__4);
7162 __Pyx_INCREF(__pyx_v_i);
7163 __Pyx_GIVEREF(__pyx_v_i);
7164 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_i);
7165 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_E, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 905, __pyx_L1_error)
7166 __Pyx_GOTREF(__pyx_t_2);
7167 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7176 __Pyx_TraceLine(904,0,__PYX_ERR(0, 904, __pyx_L1_error))
7177 __pyx_t_19 = __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_double(__pyx_v_A, __pyx_v_AtA, __pyx_v_B, __pyx_v_C, __pyx_t_2, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_solver_tol);
if (unlikely(__pyx_t_19 == ((
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 904, __pyx_L1_error)
7178 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7179 __pyx_t_2 = PyFloat_FromDouble(__pyx_t_19);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error)
7180 __Pyx_GOTREF(__pyx_t_2);
7181 if (unlikely(PyObject_SetItem(__pyx_v_samples, __pyx_v_i, __pyx_t_2) < 0)) __PYX_ERR(0, 904, __pyx_L1_error)
7182 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7191 __Pyx_TraceLine(908,0,__PYX_ERR(0, 908, __pyx_L1_error))
7192 if (unlikely(__Pyx_SetItemInt(__pyx_v_processed_samples_indices, __pyx_v_num_processed_samples, __pyx_v_i,
int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0)) __PYX_ERR(0, 908, __pyx_L1_error)
7201 __Pyx_TraceLine(909,0,__PYX_ERR(0, 909, __pyx_L1_error))
7202 __pyx_v_num_processed_samples = (__pyx_v_num_processed_samples + 1);
7211 __Pyx_TraceLine(914,0,__PYX_ERR(0, 914, __pyx_L1_error))
7212 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_check_convergence);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
7213 __Pyx_GOTREF(__pyx_t_3);
7222 __Pyx_TraceLine(916,0,__PYX_ERR(0, 916, __pyx_L1_error))
7223 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_num_processed_samples);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 916, __pyx_L1_error)
7224 __Pyx_GOTREF(__pyx_t_5);
7233 __Pyx_TraceLine(917,0,__PYX_ERR(0, 917, __pyx_L1_error))
7236 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7237 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
7238 if (likely(__pyx_t_1)) {
7239 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
7240 __Pyx_INCREF(__pyx_t_1);
7241 __Pyx_INCREF(
function);
7242 __Pyx_DECREF_SET(__pyx_t_3,
function);
7246 #if CYTHON_FAST_PYCALL
7247 if (PyFunction_Check(__pyx_t_3)) {
7248 PyObject *__pyx_temp[8] = {__pyx_t_1, __pyx_v_samples, __pyx_v_min_num_samples, __pyx_v_processed_samples_indices, __pyx_t_5, __pyx_v_confidence_level, __pyx_v_error_atol, __pyx_v_error_rtol};
7249 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 7+__pyx_t_20);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error)
7250 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7251 __Pyx_GOTREF(__pyx_t_2);
7252 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7255 #if CYTHON_FAST_PYCCALL
7256 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7257 PyObject *__pyx_temp[8] = {__pyx_t_1, __pyx_v_samples, __pyx_v_min_num_samples, __pyx_v_processed_samples_indices, __pyx_t_5, __pyx_v_confidence_level, __pyx_v_error_atol, __pyx_v_error_rtol};
7258 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 7+__pyx_t_20);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error)
7259 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7260 __Pyx_GOTREF(__pyx_t_2);
7261 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7265 __pyx_t_21 = PyTuple_New(7+__pyx_t_20);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 914, __pyx_L1_error)
7266 __Pyx_GOTREF(__pyx_t_21);
7268 __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_1); __pyx_t_1 = NULL;
7270 __Pyx_INCREF(__pyx_v_samples);
7271 __Pyx_GIVEREF(__pyx_v_samples);
7272 PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_20, __pyx_v_samples);
7273 __Pyx_INCREF(__pyx_v_min_num_samples);
7274 __Pyx_GIVEREF(__pyx_v_min_num_samples);
7275 PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_20, __pyx_v_min_num_samples);
7276 __Pyx_INCREF(__pyx_v_processed_samples_indices);
7277 __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
7278 PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_20, __pyx_v_processed_samples_indices);
7279 __Pyx_GIVEREF(__pyx_t_5);
7280 PyTuple_SET_ITEM(__pyx_t_21, 3+__pyx_t_20, __pyx_t_5);
7281 __Pyx_INCREF(__pyx_v_confidence_level);
7282 __Pyx_GIVEREF(__pyx_v_confidence_level);
7283 PyTuple_SET_ITEM(__pyx_t_21, 4+__pyx_t_20, __pyx_v_confidence_level);
7284 __Pyx_INCREF(__pyx_v_error_atol);
7285 __Pyx_GIVEREF(__pyx_v_error_atol);
7286 PyTuple_SET_ITEM(__pyx_t_21, 5+__pyx_t_20, __pyx_v_error_atol);
7287 __Pyx_INCREF(__pyx_v_error_rtol);
7288 __Pyx_GIVEREF(__pyx_v_error_rtol);
7289 PyTuple_SET_ITEM(__pyx_t_21, 6+__pyx_t_20, __pyx_v_error_rtol);
7291 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_21, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error)
7292 __Pyx_GOTREF(__pyx_t_2);
7293 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7295 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7296 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
7297 PyObject* sequence = __pyx_t_2;
7298 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7299 if (unlikely(size != 2)) {
7300 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7301 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7302 __PYX_ERR(0, 914, __pyx_L1_error)
7304 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7305 if (likely(PyTuple_CheckExact(sequence))) {
7306 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
7307 __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1);
7309 __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
7310 __pyx_t_21 = PyList_GET_ITEM(sequence, 1);
7312 __Pyx_INCREF(__pyx_t_3);
7313 __Pyx_INCREF(__pyx_t_21);
7315 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
7316 __Pyx_GOTREF(__pyx_t_3);
7317 __pyx_t_21 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 914, __pyx_L1_error)
7318 __Pyx_GOTREF(__pyx_t_21);
7320 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7322 Py_ssize_t index = -1;
7323 __pyx_t_5 = PyObject_GetIter(__pyx_t_2);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 914, __pyx_L1_error)
7324 __Pyx_GOTREF(__pyx_t_5);
7325 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7326 __pyx_t_22 = Py_TYPE(__pyx_t_5)->tp_iternext;
7327 index = 0; __pyx_t_3 = __pyx_t_22(__pyx_t_5);
if (unlikely(!__pyx_t_3))
goto __pyx_L11_unpacking_failed;
7328 __Pyx_GOTREF(__pyx_t_3);
7329 index = 1; __pyx_t_21 = __pyx_t_22(__pyx_t_5);
if (unlikely(!__pyx_t_21))
goto __pyx_L11_unpacking_failed;
7330 __Pyx_GOTREF(__pyx_t_21);
7331 if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_5), 2) < 0) __PYX_ERR(0, 914, __pyx_L1_error)
7333 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7334 goto __pyx_L12_unpacking_done;
7335 __pyx_L11_unpacking_failed:;
7336 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7338 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7339 __PYX_ERR(0, 914, __pyx_L1_error)
7340 __pyx_L12_unpacking_done:;
7350 __Pyx_TraceLine(914,0,__PYX_ERR(0, 914, __pyx_L1_error))
7351 __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_20 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L1_error)
7352 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7353 __pyx_t_23 = __Pyx_PyInt_As_int(__pyx_t_21);
if (unlikely((__pyx_t_23 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L1_error)
7354 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7355 __pyx_v_converged = __pyx_t_20;
7356 __pyx_v_num_samples_used = __pyx_t_23;
7374 __Pyx_TraceLine(899,0,__PYX_ERR(0, 899, __pyx_L1_error))
7376 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7385 __Pyx_TraceLine(919,0,__PYX_ERR(0, 919, __pyx_L1_error))
7386 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __pyx_L1_error)
7387 __Pyx_GOTREF(__pyx_t_2);
7388 __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 919, __pyx_L1_error)
7389 __Pyx_GOTREF(__pyx_t_21);
7390 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7392 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
7393 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_21);
7394 if (likely(__pyx_t_2)) {
7395 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_21);
7396 __Pyx_INCREF(__pyx_t_2);
7397 __Pyx_INCREF(
function);
7398 __Pyx_DECREF_SET(__pyx_t_21,
function);
7401 __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_21);
7402 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7403 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 919, __pyx_L1_error)
7404 __Pyx_GOTREF(__pyx_t_4);
7405 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7406 __pyx_t_21 = PyNumber_Subtract(__pyx_t_4, __pyx_v_init_alg_wall_time);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 919, __pyx_L1_error)
7407 __Pyx_GOTREF(__pyx_t_21);
7408 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7409 __pyx_v_alg_wall_time = __pyx_t_21;
7419 __Pyx_TraceLine(921,0,__PYX_ERR(0, 921, __pyx_L1_error))
7420 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_average_estimates);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 921, __pyx_L1_error)
7421 __Pyx_GOTREF(__pyx_t_4);
7430 __Pyx_TraceLine(923,0,__PYX_ERR(0, 923, __pyx_L1_error))
7431 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_num_samples_used);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error)
7432 __Pyx_GOTREF(__pyx_t_2);
7435 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
7436 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
7437 if (likely(__pyx_t_3)) {
7438 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
7439 __Pyx_INCREF(__pyx_t_3);
7440 __Pyx_INCREF(
function);
7441 __Pyx_DECREF_SET(__pyx_t_4,
function);
7445 #if CYTHON_FAST_PYCALL
7446 if (PyFunction_Check(__pyx_t_4)) {
7447 PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_max_num_samples, __pyx_t_2, __pyx_v_processed_samples_indices, __pyx_v_samples};
7448 __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_23, 6+__pyx_t_23);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 921, __pyx_L1_error)
7449 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7450 __Pyx_GOTREF(__pyx_t_21);
7451 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7454 #if CYTHON_FAST_PYCCALL
7455 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
7456 PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_max_num_samples, __pyx_t_2, __pyx_v_processed_samples_indices, __pyx_v_samples};
7457 __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_23, 6+__pyx_t_23);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 921, __pyx_L1_error)
7458 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7459 __Pyx_GOTREF(__pyx_t_21);
7460 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7464 __pyx_t_5 = PyTuple_New(6+__pyx_t_23);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 921, __pyx_L1_error)
7465 __Pyx_GOTREF(__pyx_t_5);
7467 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
7469 __Pyx_INCREF(__pyx_v_confidence_level);
7470 __Pyx_GIVEREF(__pyx_v_confidence_level);
7471 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_23, __pyx_v_confidence_level);
7472 __Pyx_INCREF(__pyx_v_outlier_significance_level);
7473 __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
7474 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_23, __pyx_v_outlier_significance_level);
7475 __Pyx_INCREF(__pyx_v_max_num_samples);
7476 __Pyx_GIVEREF(__pyx_v_max_num_samples);
7477 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_23, __pyx_v_max_num_samples);
7478 __Pyx_GIVEREF(__pyx_t_2);
7479 PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_23, __pyx_t_2);
7480 __Pyx_INCREF(__pyx_v_processed_samples_indices);
7481 __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
7482 PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_23, __pyx_v_processed_samples_indices);
7483 __Pyx_INCREF(__pyx_v_samples);
7484 __Pyx_GIVEREF(__pyx_v_samples);
7485 PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_23, __pyx_v_samples);
7487 __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 921, __pyx_L1_error)
7488 __Pyx_GOTREF(__pyx_t_21);
7489 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7491 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7492 if ((likely(PyTuple_CheckExact(__pyx_t_21))) || (PyList_CheckExact(__pyx_t_21))) {
7493 PyObject* sequence = __pyx_t_21;
7494 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7495 if (unlikely(size != 3)) {
7496 if (size > 3) __Pyx_RaiseTooManyValuesError(3);
7497 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7498 __PYX_ERR(0, 921, __pyx_L1_error)
7500 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7501 if (likely(PyTuple_CheckExact(sequence))) {
7502 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
7503 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
7504 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2);
7506 __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
7507 __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
7508 __pyx_t_2 = PyList_GET_ITEM(sequence, 2);
7510 __Pyx_INCREF(__pyx_t_4);
7511 __Pyx_INCREF(__pyx_t_5);
7512 __Pyx_INCREF(__pyx_t_2);
7514 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 921, __pyx_L1_error)
7515 __Pyx_GOTREF(__pyx_t_4);
7516 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 921, __pyx_L1_error)
7517 __Pyx_GOTREF(__pyx_t_5);
7518 __pyx_t_2 = PySequence_ITEM(sequence, 2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 921, __pyx_L1_error)
7519 __Pyx_GOTREF(__pyx_t_2);
7521 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7523 Py_ssize_t index = -1;
7524 __pyx_t_3 = PyObject_GetIter(__pyx_t_21);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 921, __pyx_L1_error)
7525 __Pyx_GOTREF(__pyx_t_3);
7526 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7527 __pyx_t_22 = Py_TYPE(__pyx_t_3)->tp_iternext;
7528 index = 0; __pyx_t_4 = __pyx_t_22(__pyx_t_3);
if (unlikely(!__pyx_t_4))
goto __pyx_L13_unpacking_failed;
7529 __Pyx_GOTREF(__pyx_t_4);
7530 index = 1; __pyx_t_5 = __pyx_t_22(__pyx_t_3);
if (unlikely(!__pyx_t_5))
goto __pyx_L13_unpacking_failed;
7531 __Pyx_GOTREF(__pyx_t_5);
7532 index = 2; __pyx_t_2 = __pyx_t_22(__pyx_t_3);
if (unlikely(!__pyx_t_2))
goto __pyx_L13_unpacking_failed;
7533 __Pyx_GOTREF(__pyx_t_2);
7534 if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_3), 3) < 0) __PYX_ERR(0, 921, __pyx_L1_error)
7536 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7537 goto __pyx_L14_unpacking_done;
7538 __pyx_L13_unpacking_failed:;
7539 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7541 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7542 __PYX_ERR(0, 921, __pyx_L1_error)
7543 __pyx_L14_unpacking_done:;
7553 __Pyx_TraceLine(921,0,__PYX_ERR(0, 921, __pyx_L1_error))
7554 __pyx_v_trace = __pyx_t_4;
7556 __pyx_v_error = __pyx_t_5;
7558 __pyx_v_num_outliers = __pyx_t_2;
7568 __Pyx_TraceLine(925,0,__PYX_ERR(0, 925, __pyx_L1_error))
7569 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 925, __pyx_L1_error)
7570 __Pyx_GOTREF(__pyx_t_2);
7571 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 925, __pyx_L1_error)
7572 __Pyx_GOTREF(__pyx_t_5);
7573 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7575 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7576 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
7577 if (likely(__pyx_t_2)) {
7578 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
7579 __Pyx_INCREF(__pyx_t_2);
7580 __Pyx_INCREF(
function);
7581 __Pyx_DECREF_SET(__pyx_t_5,
function);
7584 __pyx_t_21 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
7585 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7586 if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 925, __pyx_L1_error)
7587 __Pyx_GOTREF(__pyx_t_21);
7588 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7589 __pyx_t_5 = PyNumber_Subtract(__pyx_t_21, __pyx_v_init_tot_wall_time);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 925, __pyx_L1_error)
7590 __Pyx_GOTREF(__pyx_t_5);
7591 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7592 __pyx_v_tot_wall_time = __pyx_t_5;
7602 __Pyx_TraceLine(926,0,__PYX_ERR(0, 926, __pyx_L1_error))
7603 __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_time);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 926, __pyx_L1_error)
7604 __Pyx_GOTREF(__pyx_t_21);
7605 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_n_s_process_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 926, __pyx_L1_error)
7606 __Pyx_GOTREF(__pyx_t_2);
7607 __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7609 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7610 __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_2);
7611 if (likely(__pyx_t_21)) {
7612 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
7613 __Pyx_INCREF(__pyx_t_21);
7614 __Pyx_INCREF(
function);
7615 __Pyx_DECREF_SET(__pyx_t_2,
function);
7618 __pyx_t_5 = (__pyx_t_21) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_21) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7619 __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
7620 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 926, __pyx_L1_error)
7621 __Pyx_GOTREF(__pyx_t_5);
7622 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7623 __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_v_init_cpu_proc_time);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 926, __pyx_L1_error)
7624 __Pyx_GOTREF(__pyx_t_2);
7625 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7626 __pyx_v_cpu_proc_time = __pyx_t_2;
7636 __Pyx_TraceLine(928,0,__PYX_ERR(0, 928, __pyx_L1_error))
7637 __Pyx_XDECREF(__pyx_r);
7646 __Pyx_TraceLine(929,0,__PYX_ERR(0, 929, __pyx_L1_error))
7647 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_num_processed_samples);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error)
7648 __Pyx_GOTREF(__pyx_t_2);
7649 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_num_samples_used);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 929, __pyx_L1_error)
7650 __Pyx_GOTREF(__pyx_t_5);
7651 __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_converged);
if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 929, __pyx_L1_error)
7652 __Pyx_GOTREF(__pyx_t_21);
7661 __Pyx_TraceLine(928,0,__PYX_ERR(0, 928, __pyx_L1_error))
7662 __pyx_t_4 = PyTuple_New(11);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 928, __pyx_L1_error)
7663 __Pyx_GOTREF(__pyx_t_4);
7664 __Pyx_INCREF(__pyx_v_trace);
7665 __Pyx_GIVEREF(__pyx_v_trace);
7666 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_trace);
7667 __Pyx_INCREF(__pyx_v_error);
7668 __Pyx_GIVEREF(__pyx_v_error);
7669 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_error);
7670 __Pyx_INCREF(__pyx_v_num_outliers);
7671 __Pyx_GIVEREF(__pyx_v_num_outliers);
7672 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_num_outliers);
7673 __Pyx_INCREF(__pyx_v_samples);
7674 __Pyx_GIVEREF(__pyx_v_samples);
7675 PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_samples);
7676 __Pyx_INCREF(__pyx_v_processed_samples_indices);
7677 __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
7678 PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_processed_samples_indices);
7679 __Pyx_GIVEREF(__pyx_t_2);
7680 PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_2);
7681 __Pyx_GIVEREF(__pyx_t_5);
7682 PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_t_5);
7683 __Pyx_GIVEREF(__pyx_t_21);
7684 PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_t_21);
7685 __Pyx_INCREF(__pyx_v_tot_wall_time);
7686 __Pyx_GIVEREF(__pyx_v_tot_wall_time);
7687 PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_v_tot_wall_time);
7688 __Pyx_INCREF(__pyx_v_alg_wall_time);
7689 __Pyx_GIVEREF(__pyx_v_alg_wall_time);
7690 PyTuple_SET_ITEM(__pyx_t_4, 9, __pyx_v_alg_wall_time);
7691 __Pyx_INCREF(__pyx_v_cpu_proc_time);
7692 __Pyx_GIVEREF(__pyx_v_cpu_proc_time);
7693 PyTuple_SET_ITEM(__pyx_t_4, 10, __pyx_v_cpu_proc_time);
7697 __pyx_r = __pyx_t_4;
7711 __Pyx_XDECREF(__pyx_t_1);
7712 __Pyx_XDECREF(__pyx_t_2);
7713 __Pyx_XDECREF(__pyx_t_3);
7714 __Pyx_XDECREF(__pyx_t_4);
7715 __Pyx_XDECREF(__pyx_t_5);
7716 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
7717 __Pyx_XDECREF(__pyx_t_21);
7718 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method._hutchinson_method_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
7721 __Pyx_XDECREF(__pyx_v_vector_size);
7722 __Pyx_XDECREF(__pyx_v_E);
7723 __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_E, 1);
7724 __Pyx_XDECREF(__pyx_v_init_tot_wall_time);
7725 __Pyx_XDECREF(__pyx_v_init_cpu_proc_time);
7726 __Pyx_XDECREF(__pyx_v_samples);
7727 __Pyx_XDECREF(__pyx_v_processed_samples_indices);
7728 __Pyx_XDECREF(__pyx_v_init_alg_wall_time);
7729 __Pyx_XDECREF(__pyx_v_AtA);
7730 __Pyx_XDECREF(__pyx_v_i);
7731 __Pyx_XDECREF(__pyx_v_alg_wall_time);
7732 __Pyx_XDECREF(__pyx_v_trace);
7733 __Pyx_XDECREF(__pyx_v_error);
7734 __Pyx_XDECREF(__pyx_v_num_outliers);
7735 __Pyx_XDECREF(__pyx_v_tot_wall_time);
7736 __Pyx_XDECREF(__pyx_v_cpu_proc_time);
7737 __Pyx_XGIVEREF(__pyx_r);
7738 __Pyx_TraceReturn(__pyx_r, 0);
7739 __Pyx_RefNannyFinishContext();
7751 static float __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_float(PyObject *__pyx_v_A, PyObject *__pyx_v_AtA, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_E, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_solver_tol) {
7752 PyObject *__pyx_v_OpE = NULL;
7753 __Pyx_memviewslice __pyx_v_memoryview_E = { 0, 0, { 0 }, { 0 }, { 0 } };
7755 __Pyx_memviewslice __pyx_v_memoryview_OpE = { 0, 0, { 0 }, { 0 }, { 0 } };
7756 float *__pyx_v_cOpE;
7757 int __pyx_v_vector_size;
7758 float __pyx_v_inner_prod;
7759 float __pyx_v_trace_estimate;
7761 __Pyx_TraceDeclarations
7762 __Pyx_RefNannyDeclarations
7766 PyObject *__pyx_t_4 = NULL;
7767 PyObject *__pyx_t_5 = NULL;
7768 PyObject *__pyx_t_6 = NULL;
7770 PyObject *__pyx_t_8 = NULL;
7771 __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
7772 Py_ssize_t __pyx_t_10;
7773 int __pyx_lineno = 0;
7774 const char *__pyx_filename = NULL;
7775 int __pyx_clineno = 0;
7776 __Pyx_RefNannySetupContext(
"_stochastic_trace_estimator_float", 0);
7777 __Pyx_TraceCall(
"_stochastic_trace_estimator_float", __pyx_f[0], 937, 0, __PYX_ERR(0, 937, __pyx_L1_error));
7786 __Pyx_TraceLine(976,0,__PYX_ERR(0, 976, __pyx_L1_error))
7787 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_gram);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 976, __pyx_L1_error)
7790 __pyx_t_1 = __pyx_t_2;
7791 goto __pyx_L4_bool_binop_done;
7793 __pyx_t_2 = (__pyx_v_AtA == Py_None);
7794 __pyx_t_3 = (__pyx_t_2 != 0);
7795 __pyx_t_1 = __pyx_t_3;
7796 __pyx_L4_bool_binop_done:;
7806 __Pyx_TraceLine(977,0,__PYX_ERR(0, 977, __pyx_L1_error))
7807 __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 977, __pyx_L1_error)
7808 __Pyx_GOTREF(__pyx_t_4);
7809 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 977, __pyx_L1_error)
7810 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7813 __pyx_t_1 = __pyx_t_3;
7814 goto __pyx_L7_bool_binop_done;
7816 __pyx_t_3 = (__pyx_v_B == Py_None);
7817 __pyx_t_2 = (__pyx_t_3 != 0);
7820 __pyx_t_1 = __pyx_t_2;
7821 goto __pyx_L7_bool_binop_done;
7823 __pyx_t_2 = (__pyx_v_C == Py_None);
7824 __pyx_t_3 = (__pyx_t_2 != 0);
7825 __pyx_t_1 = __pyx_t_3;
7826 __pyx_L7_bool_binop_done:;
7827 __pyx_t_3 = ((!__pyx_t_1) != 0);
7828 if (unlikely(__pyx_t_3)) {
7837 __Pyx_TraceLine(978,0,__PYX_ERR(0, 978, __pyx_L1_error))
7838 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 978, __pyx_L1_error)
7839 __Pyx_GOTREF(__pyx_t_4);
7840 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
7841 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7842 __PYX_ERR(0, 978, __pyx_L1_error)
7869 __Pyx_TraceLine(981,0,__PYX_ERR(0, 981, __pyx_L1_error))
7870 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_operator_dot);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 981, __pyx_L1_error)
7871 __Pyx_GOTREF(__pyx_t_5);
7874 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7875 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7876 if (likely(__pyx_t_6)) {
7877 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
7878 __Pyx_INCREF(__pyx_t_6);
7879 __Pyx_INCREF(
function);
7880 __Pyx_DECREF_SET(__pyx_t_5,
function);
7884 #if CYTHON_FAST_PYCALL
7885 if (PyFunction_Check(__pyx_t_5)) {
7886 PyObject *__pyx_temp[9] = {__pyx_t_6, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E};
7887 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
7888 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7889 __Pyx_GOTREF(__pyx_t_4);
7892 #if CYTHON_FAST_PYCCALL
7893 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7894 PyObject *__pyx_temp[9] = {__pyx_t_6, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E};
7895 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
7896 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7897 __Pyx_GOTREF(__pyx_t_4);
7901 __pyx_t_8 = PyTuple_New(8+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 981, __pyx_L1_error)
7902 __Pyx_GOTREF(__pyx_t_8);
7904 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
7906 __Pyx_INCREF(__pyx_v_A);
7907 __Pyx_GIVEREF(__pyx_v_A);
7908 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_A);
7909 __Pyx_INCREF(__pyx_v_AtA);
7910 __Pyx_GIVEREF(__pyx_v_AtA);
7911 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_AtA);
7912 __Pyx_INCREF(__pyx_v_p);
7913 __Pyx_GIVEREF(__pyx_v_p);
7914 PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_p);
7915 __Pyx_INCREF(__pyx_v_gram);
7916 __Pyx_GIVEREF(__pyx_v_gram);
7917 PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_gram);
7918 __Pyx_INCREF(__pyx_v_assume_matrix);
7919 __Pyx_GIVEREF(__pyx_v_assume_matrix);
7920 PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_v_assume_matrix);
7921 __Pyx_INCREF(__pyx_v_solver_tol);
7922 __Pyx_GIVEREF(__pyx_v_solver_tol);
7923 PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_v_solver_tol);
7924 __Pyx_INCREF(__pyx_v_B);
7925 __Pyx_GIVEREF(__pyx_v_B);
7926 PyTuple_SET_ITEM(__pyx_t_8, 6+__pyx_t_7, __pyx_v_B);
7927 __Pyx_INCREF(__pyx_v_E);
7928 __Pyx_GIVEREF(__pyx_v_E);
7929 PyTuple_SET_ITEM(__pyx_t_8, 7+__pyx_t_7, __pyx_v_E);
7930 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
7931 __Pyx_GOTREF(__pyx_t_4);
7932 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7934 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7935 __pyx_v_OpE = __pyx_t_4;
7945 __Pyx_TraceLine(984,0,__PYX_ERR(0, 984, __pyx_L1_error))
7946 __pyx_t_3 = (__pyx_v_C != Py_None);
7947 __pyx_t_1 = (__pyx_t_3 != 0);
7957 __Pyx_TraceLine(985,0,__PYX_ERR(0, 985, __pyx_L1_error))
7958 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_operator_dot);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 985, __pyx_L1_error)
7959 __Pyx_GOTREF(__pyx_t_5);
7962 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7963 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
7964 if (likely(__pyx_t_8)) {
7965 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
7966 __Pyx_INCREF(__pyx_t_8);
7967 __Pyx_INCREF(
function);
7968 __Pyx_DECREF_SET(__pyx_t_5,
function);
7972 #if CYTHON_FAST_PYCALL
7973 if (PyFunction_Check(__pyx_t_5)) {
7974 PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_C, __pyx_v_OpE};
7975 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
7976 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7977 __Pyx_GOTREF(__pyx_t_4);
7980 #if CYTHON_FAST_PYCCALL
7981 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7982 PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_C, __pyx_v_OpE};
7983 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
7984 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7985 __Pyx_GOTREF(__pyx_t_4);
7989 __pyx_t_6 = PyTuple_New(8+__pyx_t_7);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 985, __pyx_L1_error)
7990 __Pyx_GOTREF(__pyx_t_6);
7992 __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
7994 __Pyx_INCREF(__pyx_v_A);
7995 __Pyx_GIVEREF(__pyx_v_A);
7996 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_A);
7997 __Pyx_INCREF(__pyx_v_AtA);
7998 __Pyx_GIVEREF(__pyx_v_AtA);
7999 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_AtA);
8000 __Pyx_INCREF(__pyx_v_p);
8001 __Pyx_GIVEREF(__pyx_v_p);
8002 PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_p);
8003 __Pyx_INCREF(__pyx_v_gram);
8004 __Pyx_GIVEREF(__pyx_v_gram);
8005 PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_gram);
8006 __Pyx_INCREF(__pyx_v_assume_matrix);
8007 __Pyx_GIVEREF(__pyx_v_assume_matrix);
8008 PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_assume_matrix);
8009 __Pyx_INCREF(__pyx_v_solver_tol);
8010 __Pyx_GIVEREF(__pyx_v_solver_tol);
8011 PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_7, __pyx_v_solver_tol);
8012 __Pyx_INCREF(__pyx_v_C);
8013 __Pyx_GIVEREF(__pyx_v_C);
8014 PyTuple_SET_ITEM(__pyx_t_6, 6+__pyx_t_7, __pyx_v_C);
8015 __Pyx_INCREF(__pyx_v_OpE);
8016 __Pyx_GIVEREF(__pyx_v_OpE);
8017 PyTuple_SET_ITEM(__pyx_t_6, 7+__pyx_t_7, __pyx_v_OpE);
8018 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
8019 __Pyx_GOTREF(__pyx_t_4);
8020 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8022 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8023 __Pyx_DECREF_SET(__pyx_v_OpE, __pyx_t_4);
8042 __Pyx_TraceLine(988,0,__PYX_ERR(0, 988, __pyx_L1_error))
8043 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_E, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 988, __pyx_L1_error)
8044 __pyx_v_memoryview_E = __pyx_t_9;
8045 __pyx_t_9.memview = NULL;
8046 __pyx_t_9.data = NULL;
8055 __Pyx_TraceLine(989,0,__PYX_ERR(0, 989, __pyx_L1_error))
8057 __pyx_v_cE = (&(*((
float *) ( (__pyx_v_memoryview_E.data + __pyx_t_10 * __pyx_v_memoryview_E.strides[0]) ))));
8066 __Pyx_TraceLine(992,0,__PYX_ERR(0, 992, __pyx_L1_error))
8067 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_OpE, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 992, __pyx_L1_error)
8068 __pyx_v_memoryview_OpE = __pyx_t_9;
8069 __pyx_t_9.memview = NULL;
8070 __pyx_t_9.data = NULL;
8079 __Pyx_TraceLine(993,0,__PYX_ERR(0, 993, __pyx_L1_error))
8081 __pyx_v_cOpE = (&(*((
float *) ( (__pyx_v_memoryview_OpE.data + __pyx_t_10 * __pyx_v_memoryview_OpE.strides[0]) ))));
8090 __Pyx_TraceLine(996,0,__PYX_ERR(0, 996, __pyx_L1_error))
8091 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 996, __pyx_L1_error)
8092 __Pyx_GOTREF(__pyx_t_4);
8093 __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 996, __pyx_L1_error)
8094 __Pyx_GOTREF(__pyx_t_5);
8095 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8096 __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5);
if (unlikely((__pyx_t_7 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 996, __pyx_L1_error)
8097 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8098 __pyx_v_vector_size = __pyx_t_7;
8107 __Pyx_TraceLine(999,0,__PYX_ERR(0, 999, __pyx_L1_error))
8108 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_gram);
if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 999, __pyx_L1_error)
8111 __pyx_t_1 = __pyx_t_3;
8112 goto __pyx_L12_bool_binop_done;
8114 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 999, __pyx_L1_error)
8115 __Pyx_GOTREF(__pyx_t_4);
8116 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abs);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 999, __pyx_L1_error)
8117 __Pyx_GOTREF(__pyx_t_6);
8118 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8120 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
8121 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
8122 if (likely(__pyx_t_4)) {
8123 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
8124 __Pyx_INCREF(__pyx_t_4);
8125 __Pyx_INCREF(
function);
8126 __Pyx_DECREF_SET(__pyx_t_6,
function);
8129 __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_p) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_p);
8130 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8131 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 999, __pyx_L1_error)
8132 __Pyx_GOTREF(__pyx_t_5);
8133 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8134 __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_1, 1, 0);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 999, __pyx_L1_error)
8135 __Pyx_GOTREF(__pyx_t_6);
8136 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8137 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6);
if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 999, __pyx_L1_error)
8138 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8141 __pyx_t_1 = __pyx_t_3;
8142 goto __pyx_L12_bool_binop_done;
8144 __pyx_t_3 = (__pyx_v_B == Py_None);
8145 __pyx_t_2 = (__pyx_t_3 != 0);
8148 __pyx_t_1 = __pyx_t_2;
8149 goto __pyx_L12_bool_binop_done;
8151 __pyx_t_2 = (__pyx_v_C == Py_None);
8152 __pyx_t_3 = (__pyx_t_2 != 0);
8153 __pyx_t_1 = __pyx_t_3;
8154 __pyx_L12_bool_binop_done:;
8164 __Pyx_TraceLine(1000,0,__PYX_ERR(0, 1000, __pyx_L1_error))
8184 __Pyx_TraceLine(1003,0,__PYX_ERR(0, 1003, __pyx_L1_error))
8194 __Pyx_TraceLine(1004,0,__PYX_ERR(0, 1004, __pyx_L1_error))
8206 __Pyx_TraceLine(1007,0,__PYX_ERR(0, 1007, __pyx_L1_error))
8207 __pyx_v_trace_estimate = (__pyx_v_vector_size * __pyx_v_inner_prod);
8216 __Pyx_TraceLine(1009,0,__PYX_ERR(0, 1009, __pyx_L1_error))
8217 __pyx_r = __pyx_v_trace_estimate;
8230 __Pyx_XDECREF(__pyx_t_4);
8231 __Pyx_XDECREF(__pyx_t_5);
8232 __Pyx_XDECREF(__pyx_t_6);
8233 __Pyx_XDECREF(__pyx_t_8);
8234 __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
8235 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method._stochastic_trace_estimator_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
8238 __Pyx_XDECREF(__pyx_v_OpE);
8239 __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_E, 1);
8240 __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_OpE, 1);
8241 __Pyx_TraceReturn(Py_None, 0);
8242 __Pyx_RefNannyFinishContext();
8254 static double __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_double(PyObject *__pyx_v_A, PyObject *__pyx_v_AtA, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_E, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_solver_tol) {
8255 PyObject *__pyx_v_OpE = NULL;
8256 __Pyx_memviewslice __pyx_v_memoryview_E = { 0, 0, { 0 }, { 0 }, { 0 } };
8258 __Pyx_memviewslice __pyx_v_memoryview_OpE = { 0, 0, { 0 }, { 0 }, { 0 } };
8259 double *__pyx_v_cOpE;
8260 int __pyx_v_vector_size;
8261 double __pyx_v_inner_prod;
8262 double __pyx_v_trace_estimate;
8264 __Pyx_TraceDeclarations
8265 __Pyx_RefNannyDeclarations
8269 PyObject *__pyx_t_4 = NULL;
8270 PyObject *__pyx_t_5 = NULL;
8271 PyObject *__pyx_t_6 = NULL;
8273 PyObject *__pyx_t_8 = NULL;
8274 __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
8275 Py_ssize_t __pyx_t_10;
8276 int __pyx_lineno = 0;
8277 const char *__pyx_filename = NULL;
8278 int __pyx_clineno = 0;
8279 __Pyx_RefNannySetupContext(
"_stochastic_trace_estimator_double", 0);
8280 __Pyx_TraceCall(
"_stochastic_trace_estimator_double", __pyx_f[0], 1016, 0, __PYX_ERR(0, 1016, __pyx_L1_error));
8289 __Pyx_TraceLine(1055,0,__PYX_ERR(0, 1055, __pyx_L1_error))
8290 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_gram);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1055, __pyx_L1_error)
8293 __pyx_t_1 = __pyx_t_2;
8294 goto __pyx_L4_bool_binop_done;
8296 __pyx_t_2 = (__pyx_v_AtA == Py_None);
8297 __pyx_t_3 = (__pyx_t_2 != 0);
8298 __pyx_t_1 = __pyx_t_3;
8299 __pyx_L4_bool_binop_done:;
8309 __Pyx_TraceLine(1056,0,__PYX_ERR(0, 1056, __pyx_L1_error))
8310 __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1056, __pyx_L1_error)
8311 __Pyx_GOTREF(__pyx_t_4);
8312 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4);
if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1056, __pyx_L1_error)
8313 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8316 __pyx_t_1 = __pyx_t_3;
8317 goto __pyx_L7_bool_binop_done;
8319 __pyx_t_3 = (__pyx_v_B == Py_None);
8320 __pyx_t_2 = (__pyx_t_3 != 0);
8323 __pyx_t_1 = __pyx_t_2;
8324 goto __pyx_L7_bool_binop_done;
8326 __pyx_t_2 = (__pyx_v_C == Py_None);
8327 __pyx_t_3 = (__pyx_t_2 != 0);
8328 __pyx_t_1 = __pyx_t_3;
8329 __pyx_L7_bool_binop_done:;
8330 __pyx_t_3 = ((!__pyx_t_1) != 0);
8331 if (unlikely(__pyx_t_3)) {
8340 __Pyx_TraceLine(1057,0,__PYX_ERR(0, 1057, __pyx_L1_error))
8341 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1057, __pyx_L1_error)
8342 __Pyx_GOTREF(__pyx_t_4);
8343 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
8344 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8345 __PYX_ERR(0, 1057, __pyx_L1_error)
8372 __Pyx_TraceLine(1060,0,__PYX_ERR(0, 1060, __pyx_L1_error))
8373 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_operator_dot);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1060, __pyx_L1_error)
8374 __Pyx_GOTREF(__pyx_t_5);
8377 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8378 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8379 if (likely(__pyx_t_6)) {
8380 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
8381 __Pyx_INCREF(__pyx_t_6);
8382 __Pyx_INCREF(
function);
8383 __Pyx_DECREF_SET(__pyx_t_5,
function);
8387 #if CYTHON_FAST_PYCALL
8388 if (PyFunction_Check(__pyx_t_5)) {
8389 PyObject *__pyx_temp[9] = {__pyx_t_6, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E};
8390 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
8391 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8392 __Pyx_GOTREF(__pyx_t_4);
8395 #if CYTHON_FAST_PYCCALL
8396 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
8397 PyObject *__pyx_temp[9] = {__pyx_t_6, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E};
8398 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
8399 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8400 __Pyx_GOTREF(__pyx_t_4);
8404 __pyx_t_8 = PyTuple_New(8+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1060, __pyx_L1_error)
8405 __Pyx_GOTREF(__pyx_t_8);
8407 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
8409 __Pyx_INCREF(__pyx_v_A);
8410 __Pyx_GIVEREF(__pyx_v_A);
8411 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_A);
8412 __Pyx_INCREF(__pyx_v_AtA);
8413 __Pyx_GIVEREF(__pyx_v_AtA);
8414 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_AtA);
8415 __Pyx_INCREF(__pyx_v_p);
8416 __Pyx_GIVEREF(__pyx_v_p);
8417 PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_p);
8418 __Pyx_INCREF(__pyx_v_gram);
8419 __Pyx_GIVEREF(__pyx_v_gram);
8420 PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_gram);
8421 __Pyx_INCREF(__pyx_v_assume_matrix);
8422 __Pyx_GIVEREF(__pyx_v_assume_matrix);
8423 PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_v_assume_matrix);
8424 __Pyx_INCREF(__pyx_v_solver_tol);
8425 __Pyx_GIVEREF(__pyx_v_solver_tol);
8426 PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_v_solver_tol);
8427 __Pyx_INCREF(__pyx_v_B);
8428 __Pyx_GIVEREF(__pyx_v_B);
8429 PyTuple_SET_ITEM(__pyx_t_8, 6+__pyx_t_7, __pyx_v_B);
8430 __Pyx_INCREF(__pyx_v_E);
8431 __Pyx_GIVEREF(__pyx_v_E);
8432 PyTuple_SET_ITEM(__pyx_t_8, 7+__pyx_t_7, __pyx_v_E);
8433 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
8434 __Pyx_GOTREF(__pyx_t_4);
8435 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8437 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8438 __pyx_v_OpE = __pyx_t_4;
8448 __Pyx_TraceLine(1063,0,__PYX_ERR(0, 1063, __pyx_L1_error))
8449 __pyx_t_3 = (__pyx_v_C != Py_None);
8450 __pyx_t_1 = (__pyx_t_3 != 0);
8460 __Pyx_TraceLine(1064,0,__PYX_ERR(0, 1064, __pyx_L1_error))
8461 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_operator_dot);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error)
8462 __Pyx_GOTREF(__pyx_t_5);
8465 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8466 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
8467 if (likely(__pyx_t_8)) {
8468 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
8469 __Pyx_INCREF(__pyx_t_8);
8470 __Pyx_INCREF(
function);
8471 __Pyx_DECREF_SET(__pyx_t_5,
function);
8475 #if CYTHON_FAST_PYCALL
8476 if (PyFunction_Check(__pyx_t_5)) {
8477 PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_C, __pyx_v_OpE};
8478 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
8479 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8480 __Pyx_GOTREF(__pyx_t_4);
8483 #if CYTHON_FAST_PYCCALL
8484 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
8485 PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_C, __pyx_v_OpE};
8486 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
8487 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8488 __Pyx_GOTREF(__pyx_t_4);
8492 __pyx_t_6 = PyTuple_New(8+__pyx_t_7);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1064, __pyx_L1_error)
8493 __Pyx_GOTREF(__pyx_t_6);
8495 __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
8497 __Pyx_INCREF(__pyx_v_A);
8498 __Pyx_GIVEREF(__pyx_v_A);
8499 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_A);
8500 __Pyx_INCREF(__pyx_v_AtA);
8501 __Pyx_GIVEREF(__pyx_v_AtA);
8502 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_AtA);
8503 __Pyx_INCREF(__pyx_v_p);
8504 __Pyx_GIVEREF(__pyx_v_p);
8505 PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_p);
8506 __Pyx_INCREF(__pyx_v_gram);
8507 __Pyx_GIVEREF(__pyx_v_gram);
8508 PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_gram);
8509 __Pyx_INCREF(__pyx_v_assume_matrix);
8510 __Pyx_GIVEREF(__pyx_v_assume_matrix);
8511 PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_assume_matrix);
8512 __Pyx_INCREF(__pyx_v_solver_tol);
8513 __Pyx_GIVEREF(__pyx_v_solver_tol);
8514 PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_7, __pyx_v_solver_tol);
8515 __Pyx_INCREF(__pyx_v_C);
8516 __Pyx_GIVEREF(__pyx_v_C);
8517 PyTuple_SET_ITEM(__pyx_t_6, 6+__pyx_t_7, __pyx_v_C);
8518 __Pyx_INCREF(__pyx_v_OpE);
8519 __Pyx_GIVEREF(__pyx_v_OpE);
8520 PyTuple_SET_ITEM(__pyx_t_6, 7+__pyx_t_7, __pyx_v_OpE);
8521 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
8522 __Pyx_GOTREF(__pyx_t_4);
8523 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8525 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8526 __Pyx_DECREF_SET(__pyx_v_OpE, __pyx_t_4);
8545 __Pyx_TraceLine(1067,0,__PYX_ERR(0, 1067, __pyx_L1_error))
8546 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_E, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1067, __pyx_L1_error)
8547 __pyx_v_memoryview_E = __pyx_t_9;
8548 __pyx_t_9.memview = NULL;
8549 __pyx_t_9.data = NULL;
8558 __Pyx_TraceLine(1068,0,__PYX_ERR(0, 1068, __pyx_L1_error))
8560 __pyx_v_cE = (&(*((
double *) ( (__pyx_v_memoryview_E.data + __pyx_t_10 * __pyx_v_memoryview_E.strides[0]) ))));
8569 __Pyx_TraceLine(1071,0,__PYX_ERR(0, 1071, __pyx_L1_error))
8570 __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_OpE, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1071, __pyx_L1_error)
8571 __pyx_v_memoryview_OpE = __pyx_t_9;
8572 __pyx_t_9.memview = NULL;
8573 __pyx_t_9.data = NULL;
8582 __Pyx_TraceLine(1072,0,__PYX_ERR(0, 1072, __pyx_L1_error))
8584 __pyx_v_cOpE = (&(*((
double *) ( (__pyx_v_memoryview_OpE.data + __pyx_t_10 * __pyx_v_memoryview_OpE.strides[0]) ))));
8593 __Pyx_TraceLine(1075,0,__PYX_ERR(0, 1075, __pyx_L1_error))
8594 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1075, __pyx_L1_error)
8595 __Pyx_GOTREF(__pyx_t_4);
8596 __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1075, __pyx_L1_error)
8597 __Pyx_GOTREF(__pyx_t_5);
8598 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8599 __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5);
if (unlikely((__pyx_t_7 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1075, __pyx_L1_error)
8600 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8601 __pyx_v_vector_size = __pyx_t_7;
8610 __Pyx_TraceLine(1078,0,__PYX_ERR(0, 1078, __pyx_L1_error))
8611 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_gram);
if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1078, __pyx_L1_error)
8614 __pyx_t_1 = __pyx_t_3;
8615 goto __pyx_L12_bool_binop_done;
8617 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1078, __pyx_L1_error)
8618 __Pyx_GOTREF(__pyx_t_4);
8619 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abs);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1078, __pyx_L1_error)
8620 __Pyx_GOTREF(__pyx_t_6);
8621 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8623 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
8624 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
8625 if (likely(__pyx_t_4)) {
8626 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
8627 __Pyx_INCREF(__pyx_t_4);
8628 __Pyx_INCREF(
function);
8629 __Pyx_DECREF_SET(__pyx_t_6,
function);
8632 __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_p) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_p);
8633 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8634 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1078, __pyx_L1_error)
8635 __Pyx_GOTREF(__pyx_t_5);
8636 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8637 __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_1, 1, 0);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1078, __pyx_L1_error)
8638 __Pyx_GOTREF(__pyx_t_6);
8639 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8640 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6);
if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1078, __pyx_L1_error)
8641 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8644 __pyx_t_1 = __pyx_t_3;
8645 goto __pyx_L12_bool_binop_done;
8647 __pyx_t_3 = (__pyx_v_B == Py_None);
8648 __pyx_t_2 = (__pyx_t_3 != 0);
8651 __pyx_t_1 = __pyx_t_2;
8652 goto __pyx_L12_bool_binop_done;
8654 __pyx_t_2 = (__pyx_v_C == Py_None);
8655 __pyx_t_3 = (__pyx_t_2 != 0);
8656 __pyx_t_1 = __pyx_t_3;
8657 __pyx_L12_bool_binop_done:;
8667 __Pyx_TraceLine(1079,0,__PYX_ERR(0, 1079, __pyx_L1_error))
8687 __Pyx_TraceLine(1082,0,__PYX_ERR(0, 1082, __pyx_L1_error))
8697 __Pyx_TraceLine(1083,0,__PYX_ERR(0, 1083, __pyx_L1_error))
8709 __Pyx_TraceLine(1086,0,__PYX_ERR(0, 1086, __pyx_L1_error))
8710 __pyx_v_trace_estimate = (__pyx_v_vector_size * __pyx_v_inner_prod);
8719 __Pyx_TraceLine(1088,0,__PYX_ERR(0, 1088, __pyx_L1_error))
8720 __pyx_r = __pyx_v_trace_estimate;
8733 __Pyx_XDECREF(__pyx_t_4);
8734 __Pyx_XDECREF(__pyx_t_5);
8735 __Pyx_XDECREF(__pyx_t_6);
8736 __Pyx_XDECREF(__pyx_t_8);
8737 __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
8738 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method._stochastic_trace_estimator_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
8741 __Pyx_XDECREF(__pyx_v_OpE);
8742 __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_E, 1);
8743 __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_OpE, 1);
8744 __Pyx_TraceReturn(Py_None, 0);
8745 __Pyx_RefNannyFinishContext();
8758 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_7_operator_dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
8759 static char __pyx_doc_5imate_8traceinv_18_hutchinson_method_6_operator_dot[] =
"_operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, B, E)\n\n Computes either of the followings:\n\n * Ainv * B * E\n * (Ainv ** p) * B * E\n * AtA * B * E\n * (AtA ** p) * B * E\n ";
8760 static PyMethodDef __pyx_mdef_5imate_8traceinv_18_hutchinson_method_7_operator_dot = {
"_operator_dot", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_8traceinv_18_hutchinson_method_7_operator_dot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_8traceinv_18_hutchinson_method_6_operator_dot};
8761 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_7_operator_dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8762 PyObject *__pyx_v_A = 0;
8763 PyObject *__pyx_v_AtA = 0;
8764 PyObject *__pyx_v_p = 0;
8765 PyObject *__pyx_v_gram = 0;
8766 PyObject *__pyx_v_assume_matrix = 0;
8767 PyObject *__pyx_v_solver_tol = 0;
8768 PyObject *__pyx_v_B = 0;
8769 PyObject *__pyx_v_E = 0;
8770 int __pyx_lineno = 0;
8771 const char *__pyx_filename = NULL;
8772 int __pyx_clineno = 0;
8773 PyObject *__pyx_r = 0;
8774 __Pyx_RefNannyDeclarations
8775 __Pyx_RefNannySetupContext(
"_operator_dot (wrapper)", 0);
8777 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_AtA,&__pyx_n_s_p,&__pyx_n_s_gram,&__pyx_n_s_assume_matrix,&__pyx_n_s_solver_tol,&__pyx_n_s_B,&__pyx_n_s_E,0};
8778 PyObject* values[8] = {0,0,0,0,0,0,0,0};
8779 if (unlikely(__pyx_kwds)) {
8781 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8783 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8785 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8787 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8789 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8791 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8793 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8795 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8797 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8800 default:
goto __pyx_L5_argtuple_error;
8802 kw_args = PyDict_Size(__pyx_kwds);
8805 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
8806 else goto __pyx_L5_argtuple_error;
8809 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_AtA)) != 0)) kw_args--;
8811 __Pyx_RaiseArgtupleInvalid(
"_operator_dot", 1, 8, 8, 1); __PYX_ERR(0, 1095, __pyx_L3_error)
8815 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
8817 __Pyx_RaiseArgtupleInvalid(
"_operator_dot", 1, 8, 8, 2); __PYX_ERR(0, 1095, __pyx_L3_error)
8821 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gram)) != 0)) kw_args--;
8823 __Pyx_RaiseArgtupleInvalid(
"_operator_dot", 1, 8, 8, 3); __PYX_ERR(0, 1095, __pyx_L3_error)
8827 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_assume_matrix)) != 0)) kw_args--;
8829 __Pyx_RaiseArgtupleInvalid(
"_operator_dot", 1, 8, 8, 4); __PYX_ERR(0, 1095, __pyx_L3_error)
8833 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_solver_tol)) != 0)) kw_args--;
8835 __Pyx_RaiseArgtupleInvalid(
"_operator_dot", 1, 8, 8, 5); __PYX_ERR(0, 1095, __pyx_L3_error)
8839 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
8841 __Pyx_RaiseArgtupleInvalid(
"_operator_dot", 1, 8, 8, 6); __PYX_ERR(0, 1095, __pyx_L3_error)
8845 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 0)) kw_args--;
8847 __Pyx_RaiseArgtupleInvalid(
"_operator_dot", 1, 8, 8, 7); __PYX_ERR(0, 1095, __pyx_L3_error)
8850 if (unlikely(kw_args > 0)) {
8851 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"_operator_dot") < 0)) __PYX_ERR(0, 1095, __pyx_L3_error)
8853 }
else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
8854 goto __pyx_L5_argtuple_error;
8856 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8857 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8858 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8859 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8860 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8861 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8862 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8863 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8865 __pyx_v_A = values[0];
8866 __pyx_v_AtA = values[1];
8867 __pyx_v_p = values[2];
8868 __pyx_v_gram = values[3];
8869 __pyx_v_assume_matrix = values[4];
8870 __pyx_v_solver_tol = values[5];
8871 __pyx_v_B = values[6];
8872 __pyx_v_E = values[7];
8874 goto __pyx_L4_argument_unpacking_done;
8875 __pyx_L5_argtuple_error:;
8876 __Pyx_RaiseArgtupleInvalid(
"_operator_dot", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1095, __pyx_L3_error)
8878 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method._operator_dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
8879 __Pyx_RefNannyFinishContext();
8881 __pyx_L4_argument_unpacking_done:;
8882 __pyx_r = __pyx_pf_5imate_8traceinv_18_hutchinson_method_6_operator_dot(__pyx_self, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E);
8885 __Pyx_RefNannyFinishContext();
8889 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_6_operator_dot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_AtA, PyObject *__pyx_v_p, PyObject *__pyx_v_gram, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_B, PyObject *__pyx_v_E) {
8890 PyObject *__pyx_v_BE = NULL;
8891 PyObject *__pyx_v_OpE = NULL;
8892 CYTHON_UNUSED PyObject *__pyx_v_i = NULL;
8893 CYTHON_UNUSED PyObject *__pyx_v_AinvpE = NULL;
8894 PyObject *__pyx_r = NULL;
8895 __Pyx_TraceDeclarations
8896 __Pyx_RefNannyDeclarations
8899 PyObject *__pyx_t_3 = NULL;
8900 PyObject *__pyx_t_4 = NULL;
8901 PyObject *__pyx_t_5 = NULL;
8902 PyObject *__pyx_t_6 = NULL;
8904 PyObject *__pyx_t_8 = NULL;
8905 Py_ssize_t __pyx_t_9;
8906 PyObject *(*__pyx_t_10)(PyObject *);
8907 int __pyx_lineno = 0;
8908 const char *__pyx_filename = NULL;
8909 int __pyx_clineno = 0;
8910 __Pyx_TraceFrameInit(__pyx_codeobj__7)
8911 __Pyx_RefNannySetupContext(
"_operator_dot", 0);
8912 __Pyx_TraceCall(
"_operator_dot", __pyx_f[0], 1095, 0, __PYX_ERR(0, 1095, __pyx_L1_error));
8921 __Pyx_TraceLine(1106,0,__PYX_ERR(0, 1106, __pyx_L1_error))
8922 __pyx_t_1 = (__pyx_v_B != Py_None);
8923 __pyx_t_2 = (__pyx_t_1 != 0);
8933 __Pyx_TraceLine(1107,0,__PYX_ERR(0, 1107, __pyx_L1_error))
8934 __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_B, __pyx_v_E);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1107, __pyx_L1_error)
8935 __Pyx_GOTREF(__pyx_t_3);
8936 __pyx_v_BE = __pyx_t_3;
8956 __Pyx_TraceLine(1110,0,__PYX_ERR(0, 1110, __pyx_L1_error))
8958 __Pyx_INCREF(__pyx_v_E);
8959 __pyx_v_BE = __pyx_v_E;
8970 __Pyx_TraceLine(1115,0,__PYX_ERR(0, 1115, __pyx_L1_error))
8971 __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_0, 0, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1115, __pyx_L1_error)
8972 __Pyx_GOTREF(__pyx_t_3);
8973 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1115, __pyx_L1_error)
8974 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8984 __Pyx_TraceLine(1117,0,__PYX_ERR(0, 1117, __pyx_L1_error))
8985 __Pyx_INCREF(__pyx_v_BE);
8986 __pyx_v_OpE = __pyx_v_BE;
9005 __Pyx_TraceLine(1119,0,__PYX_ERR(0, 1119, __pyx_L1_error))
9006 __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1119, __pyx_L1_error)
9007 __Pyx_GOTREF(__pyx_t_3);
9008 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1119, __pyx_L1_error)
9009 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9019 __Pyx_TraceLine(1121,0,__PYX_ERR(0, 1121, __pyx_L1_error))
9020 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_gram);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1121, __pyx_L1_error)
9030 __Pyx_TraceLine(1122,0,__PYX_ERR(0, 1122, __pyx_L1_error))
9031 __pyx_t_2 = (__pyx_v_B == Py_None);
9032 __pyx_t_1 = (__pyx_t_2 != 0);
9042 __Pyx_TraceLine(1123,0,__PYX_ERR(0, 1123, __pyx_L1_error))
9043 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_linear_solver);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error)
9044 __Pyx_GOTREF(__pyx_t_4);
9045 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_T);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1123, __pyx_L1_error)
9046 __Pyx_GOTREF(__pyx_t_5);
9049 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9050 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
9051 if (likely(__pyx_t_6)) {
9052 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
9053 __Pyx_INCREF(__pyx_t_6);
9054 __Pyx_INCREF(
function);
9055 __Pyx_DECREF_SET(__pyx_t_4,
function);
9059 #if CYTHON_FAST_PYCALL
9060 if (PyFunction_Check(__pyx_t_4)) {
9061 PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_5, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9062 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
9063 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9064 __Pyx_GOTREF(__pyx_t_3);
9065 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9068 #if CYTHON_FAST_PYCCALL
9069 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
9070 PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_5, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9071 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
9072 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9073 __Pyx_GOTREF(__pyx_t_3);
9074 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9078 __pyx_t_8 = PyTuple_New(4+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1123, __pyx_L1_error)
9079 __Pyx_GOTREF(__pyx_t_8);
9081 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
9083 __Pyx_GIVEREF(__pyx_t_5);
9084 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5);
9085 __Pyx_INCREF(__pyx_v_BE);
9086 __Pyx_GIVEREF(__pyx_v_BE);
9087 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_BE);
9088 __Pyx_INCREF(__pyx_v_assume_matrix);
9089 __Pyx_GIVEREF(__pyx_v_assume_matrix);
9090 PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_assume_matrix);
9091 __Pyx_INCREF(__pyx_v_solver_tol);
9092 __Pyx_GIVEREF(__pyx_v_solver_tol);
9093 PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_solver_tol);
9095 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
9096 __Pyx_GOTREF(__pyx_t_3);
9097 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9099 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9100 __pyx_v_OpE = __pyx_t_3;
9120 __Pyx_TraceLine(1125,0,__PYX_ERR(0, 1125, __pyx_L1_error))
9122 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_linear_solver);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error)
9123 __Pyx_GOTREF(__pyx_t_4);
9126 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9127 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
9128 if (likely(__pyx_t_8)) {
9129 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
9130 __Pyx_INCREF(__pyx_t_8);
9131 __Pyx_INCREF(
function);
9132 __Pyx_DECREF_SET(__pyx_t_4,
function);
9136 #if CYTHON_FAST_PYCALL
9137 if (PyFunction_Check(__pyx_t_4)) {
9138 PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_AtA, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9139 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
9140 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9141 __Pyx_GOTREF(__pyx_t_3);
9144 #if CYTHON_FAST_PYCCALL
9145 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
9146 PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_AtA, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9147 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
9148 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9149 __Pyx_GOTREF(__pyx_t_3);
9153 __pyx_t_5 = PyTuple_New(4+__pyx_t_7);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1125, __pyx_L1_error)
9154 __Pyx_GOTREF(__pyx_t_5);
9156 __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
9158 __Pyx_INCREF(__pyx_v_AtA);
9159 __Pyx_GIVEREF(__pyx_v_AtA);
9160 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_AtA);
9161 __Pyx_INCREF(__pyx_v_BE);
9162 __Pyx_GIVEREF(__pyx_v_BE);
9163 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_BE);
9164 __Pyx_INCREF(__pyx_v_assume_matrix);
9165 __Pyx_GIVEREF(__pyx_v_assume_matrix);
9166 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_assume_matrix);
9167 __Pyx_INCREF(__pyx_v_solver_tol);
9168 __Pyx_GIVEREF(__pyx_v_solver_tol);
9169 PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_7, __pyx_v_solver_tol);
9170 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
9171 __Pyx_GOTREF(__pyx_t_3);
9172 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9174 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9175 __pyx_v_OpE = __pyx_t_3;
9197 __Pyx_TraceLine(1127,0,__PYX_ERR(0, 1127, __pyx_L1_error))
9199 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_linear_solver);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1127, __pyx_L1_error)
9200 __Pyx_GOTREF(__pyx_t_4);
9203 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9204 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9205 if (likely(__pyx_t_5)) {
9206 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
9207 __Pyx_INCREF(__pyx_t_5);
9208 __Pyx_INCREF(
function);
9209 __Pyx_DECREF_SET(__pyx_t_4,
function);
9213 #if CYTHON_FAST_PYCALL
9214 if (PyFunction_Check(__pyx_t_4)) {
9215 PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_A, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9216 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1127, __pyx_L1_error)
9217 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9218 __Pyx_GOTREF(__pyx_t_3);
9221 #if CYTHON_FAST_PYCCALL
9222 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
9223 PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_A, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9224 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1127, __pyx_L1_error)
9225 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9226 __Pyx_GOTREF(__pyx_t_3);
9230 __pyx_t_8 = PyTuple_New(4+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1127, __pyx_L1_error)
9231 __Pyx_GOTREF(__pyx_t_8);
9233 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
9235 __Pyx_INCREF(__pyx_v_A);
9236 __Pyx_GIVEREF(__pyx_v_A);
9237 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_A);
9238 __Pyx_INCREF(__pyx_v_BE);
9239 __Pyx_GIVEREF(__pyx_v_BE);
9240 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_BE);
9241 __Pyx_INCREF(__pyx_v_assume_matrix);
9242 __Pyx_GIVEREF(__pyx_v_assume_matrix);
9243 PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_assume_matrix);
9244 __Pyx_INCREF(__pyx_v_solver_tol);
9245 __Pyx_GIVEREF(__pyx_v_solver_tol);
9246 PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_solver_tol);
9247 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1127, __pyx_L1_error)
9248 __Pyx_GOTREF(__pyx_t_3);
9249 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9251 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9252 __pyx_v_OpE = __pyx_t_3;
9274 __Pyx_TraceLine(1129,0,__PYX_ERR(0, 1129, __pyx_L1_error))
9275 __pyx_t_3 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1129, __pyx_L1_error)
9276 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1129, __pyx_L1_error)
9277 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9287 __Pyx_TraceLine(1132,0,__PYX_ERR(0, 1132, __pyx_L1_error))
9288 __Pyx_INCREF(__pyx_v_BE);
9289 __pyx_v_OpE = __pyx_v_BE;
9298 __Pyx_TraceLine(1134,0,__PYX_ERR(0, 1134, __pyx_L1_error))
9299 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_gram);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1134, __pyx_L1_error)
9309 __Pyx_TraceLine(1135,0,__PYX_ERR(0, 1135, __pyx_L1_error))
9310 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_p);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
9311 __Pyx_GOTREF(__pyx_t_3);
9312 if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
9313 __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
9316 __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1135, __pyx_L1_error)
9317 __Pyx_GOTREF(__pyx_t_4);
9318 __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1135, __pyx_L1_error)
9320 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9322 if (likely(!__pyx_t_10)) {
9323 if (likely(PyList_CheckExact(__pyx_t_4))) {
9324 if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4))
break;
9325 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9326 __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++;
if (unlikely(0 < 0)) __PYX_ERR(0, 1135, __pyx_L1_error)
9328 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
9329 __Pyx_GOTREF(__pyx_t_3);
9332 if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
9333 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9334 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++;
if (unlikely(0 < 0)) __PYX_ERR(0, 1135, __pyx_L1_error)
9336 __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++;
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
9337 __Pyx_GOTREF(__pyx_t_3);
9341 __pyx_t_3 = __pyx_t_10(__pyx_t_4);
9342 if (unlikely(!__pyx_t_3)) {
9343 PyObject* exc_type = PyErr_Occurred();
9345 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9346 else __PYX_ERR(0, 1135, __pyx_L1_error)
9350 __Pyx_GOTREF(__pyx_t_3);
9352 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
9362 __Pyx_TraceLine(1136,0,__PYX_ERR(0, 1136, __pyx_L1_error))
9363 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_linear_solver);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1136, __pyx_L1_error)
9364 __Pyx_GOTREF(__pyx_t_8);
9367 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
9368 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
9369 if (likely(__pyx_t_5)) {
9370 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_8);
9371 __Pyx_INCREF(__pyx_t_5);
9372 __Pyx_INCREF(
function);
9373 __Pyx_DECREF_SET(__pyx_t_8,
function);
9377 #if CYTHON_FAST_PYCALL
9378 if (PyFunction_Check(__pyx_t_8)) {
9379 PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_AtA, __pyx_v_OpE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9380 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
9381 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9382 __Pyx_GOTREF(__pyx_t_3);
9385 #if CYTHON_FAST_PYCCALL
9386 if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
9387 PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_AtA, __pyx_v_OpE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9388 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
9389 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9390 __Pyx_GOTREF(__pyx_t_3);
9394 __pyx_t_6 = PyTuple_New(4+__pyx_t_7);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1136, __pyx_L1_error)
9395 __Pyx_GOTREF(__pyx_t_6);
9397 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
9399 __Pyx_INCREF(__pyx_v_AtA);
9400 __Pyx_GIVEREF(__pyx_v_AtA);
9401 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_AtA);
9402 __Pyx_INCREF(__pyx_v_OpE);
9403 __Pyx_GIVEREF(__pyx_v_OpE);
9404 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_OpE);
9405 __Pyx_INCREF(__pyx_v_assume_matrix);
9406 __Pyx_GIVEREF(__pyx_v_assume_matrix);
9407 PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_assume_matrix);
9408 __Pyx_INCREF(__pyx_v_solver_tol);
9409 __Pyx_GIVEREF(__pyx_v_solver_tol);
9410 PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_solver_tol);
9411 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
9412 __Pyx_GOTREF(__pyx_t_3);
9413 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9415 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9416 __Pyx_DECREF_SET(__pyx_v_OpE, __pyx_t_3);
9426 __Pyx_TraceLine(1135,0,__PYX_ERR(0, 1135, __pyx_L1_error))
9428 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9447 __Pyx_TraceLine(1138,0,__PYX_ERR(0, 1138, __pyx_L1_error))
9449 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_p);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1138, __pyx_L1_error)
9450 __Pyx_GOTREF(__pyx_t_4);
9451 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
9452 __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
9455 __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error)
9456 __Pyx_GOTREF(__pyx_t_3);
9457 __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1138, __pyx_L1_error)
9459 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9461 if (likely(!__pyx_t_10)) {
9462 if (likely(PyList_CheckExact(__pyx_t_3))) {
9463 if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3))
break;
9464 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9465 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++;
if (unlikely(0 < 0)) __PYX_ERR(0, 1138, __pyx_L1_error)
9467 __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1138, __pyx_L1_error)
9468 __Pyx_GOTREF(__pyx_t_4);
9471 if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
9472 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9473 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++;
if (unlikely(0 < 0)) __PYX_ERR(0, 1138, __pyx_L1_error)
9475 __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1138, __pyx_L1_error)
9476 __Pyx_GOTREF(__pyx_t_4);
9480 __pyx_t_4 = __pyx_t_10(__pyx_t_3);
9481 if (unlikely(!__pyx_t_4)) {
9482 PyObject* exc_type = PyErr_Occurred();
9484 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9485 else __PYX_ERR(0, 1138, __pyx_L1_error)
9489 __Pyx_GOTREF(__pyx_t_4);
9491 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
9501 __Pyx_TraceLine(1139,0,__PYX_ERR(0, 1139, __pyx_L1_error))
9502 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_linear_solver);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1139, __pyx_L1_error)
9503 __Pyx_GOTREF(__pyx_t_8);
9506 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
9507 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
9508 if (likely(__pyx_t_6)) {
9509 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_8);
9510 __Pyx_INCREF(__pyx_t_6);
9511 __Pyx_INCREF(
function);
9512 __Pyx_DECREF_SET(__pyx_t_8,
function);
9516 #if CYTHON_FAST_PYCALL
9517 if (PyFunction_Check(__pyx_t_8)) {
9518 PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_A, __pyx_v_OpE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9519 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1139, __pyx_L1_error)
9520 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9521 __Pyx_GOTREF(__pyx_t_4);
9524 #if CYTHON_FAST_PYCCALL
9525 if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
9526 PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_A, __pyx_v_OpE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9527 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1139, __pyx_L1_error)
9528 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9529 __Pyx_GOTREF(__pyx_t_4);
9533 __pyx_t_5 = PyTuple_New(4+__pyx_t_7);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1139, __pyx_L1_error)
9534 __Pyx_GOTREF(__pyx_t_5);
9536 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
9538 __Pyx_INCREF(__pyx_v_A);
9539 __Pyx_GIVEREF(__pyx_v_A);
9540 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_A);
9541 __Pyx_INCREF(__pyx_v_OpE);
9542 __Pyx_GIVEREF(__pyx_v_OpE);
9543 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_OpE);
9544 __Pyx_INCREF(__pyx_v_assume_matrix);
9545 __Pyx_GIVEREF(__pyx_v_assume_matrix);
9546 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_assume_matrix);
9547 __Pyx_INCREF(__pyx_v_solver_tol);
9548 __Pyx_GIVEREF(__pyx_v_solver_tol);
9549 PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_7, __pyx_v_solver_tol);
9550 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1139, __pyx_L1_error)
9551 __Pyx_GOTREF(__pyx_t_4);
9552 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9554 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9555 __Pyx_DECREF_SET(__pyx_v_OpE, __pyx_t_4);
9565 __Pyx_TraceLine(1138,0,__PYX_ERR(0, 1138, __pyx_L1_error))
9567 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9588 __Pyx_TraceLine(1141,0,__PYX_ERR(0, 1141, __pyx_L1_error))
9589 __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_neg_1, -1L, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1141, __pyx_L1_error)
9590 __Pyx_GOTREF(__pyx_t_3);
9591 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1141, __pyx_L1_error)
9592 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9602 __Pyx_TraceLine(1143,0,__PYX_ERR(0, 1143, __pyx_L1_error))
9603 __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_A, __pyx_v_BE);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error)
9604 __Pyx_GOTREF(__pyx_t_3);
9605 __pyx_v_OpE = __pyx_t_3;
9625 __Pyx_TraceLine(1145,0,__PYX_ERR(0, 1145, __pyx_L1_error))
9626 __pyx_t_3 = PyObject_RichCompare(__pyx_v_p, __pyx_int_neg_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1145, __pyx_L1_error)
9627 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1145, __pyx_L1_error)
9628 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9638 __Pyx_TraceLine(1147,0,__PYX_ERR(0, 1147, __pyx_L1_error))
9639 __Pyx_INCREF(__pyx_v_BE);
9640 __pyx_v_AinvpE = __pyx_v_BE;
9649 __Pyx_TraceLine(1148,0,__PYX_ERR(0, 1148, __pyx_L1_error))
9650 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_gram);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1148, __pyx_L1_error)
9660 __Pyx_TraceLine(1149,0,__PYX_ERR(0, 1149, __pyx_L1_error))
9661 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
9662 __Pyx_GOTREF(__pyx_t_4);
9663 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abs);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error)
9664 __Pyx_GOTREF(__pyx_t_8);
9665 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9667 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
9668 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
9669 if (likely(__pyx_t_4)) {
9670 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_8);
9671 __Pyx_INCREF(__pyx_t_4);
9672 __Pyx_INCREF(
function);
9673 __Pyx_DECREF_SET(__pyx_t_8,
function);
9676 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_v_p) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_p);
9677 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9678 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1149, __pyx_L1_error)
9679 __Pyx_GOTREF(__pyx_t_3);
9680 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9681 __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error)
9682 __Pyx_GOTREF(__pyx_t_8);
9683 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9684 if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
9685 __pyx_t_3 = __pyx_t_8; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
9688 __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_8);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1149, __pyx_L1_error)
9689 __Pyx_GOTREF(__pyx_t_3);
9690 __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1149, __pyx_L1_error)
9692 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9694 if (likely(!__pyx_t_10)) {
9695 if (likely(PyList_CheckExact(__pyx_t_3))) {
9696 if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3))
break;
9697 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9698 __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
if (unlikely(0 < 0)) __PYX_ERR(0, 1149, __pyx_L1_error)
9700 __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++;
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error)
9701 __Pyx_GOTREF(__pyx_t_8);
9704 if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
9705 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9706 __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++;
if (unlikely(0 < 0)) __PYX_ERR(0, 1149, __pyx_L1_error)
9708 __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++;
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error)
9709 __Pyx_GOTREF(__pyx_t_8);
9713 __pyx_t_8 = __pyx_t_10(__pyx_t_3);
9714 if (unlikely(!__pyx_t_8)) {
9715 PyObject* exc_type = PyErr_Occurred();
9717 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9718 else __PYX_ERR(0, 1149, __pyx_L1_error)
9722 __Pyx_GOTREF(__pyx_t_8);
9724 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
9734 __Pyx_TraceLine(1150,0,__PYX_ERR(0, 1150, __pyx_L1_error))
9735 if (unlikely(!__pyx_v_OpE)) { __Pyx_RaiseUnboundLocalError(
"OpE"); __PYX_ERR(0, 1150, __pyx_L1_error) }
9736 __pyx_t_8 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_AtA, __pyx_v_OpE);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1150, __pyx_L1_error)
9737 __Pyx_GOTREF(__pyx_t_8);
9738 __Pyx_XDECREF_SET(__pyx_v_OpE, __pyx_t_8);
9748 __Pyx_TraceLine(1149,0,__PYX_ERR(0, 1149, __pyx_L1_error))
9750 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9769 __Pyx_TraceLine(1152,0,__PYX_ERR(0, 1152, __pyx_L1_error))
9771 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1152, __pyx_L1_error)
9772 __Pyx_GOTREF(__pyx_t_8);
9773 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_abs);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1152, __pyx_L1_error)
9774 __Pyx_GOTREF(__pyx_t_4);
9775 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9777 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9778 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
9779 if (likely(__pyx_t_8)) {
9780 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
9781 __Pyx_INCREF(__pyx_t_8);
9782 __Pyx_INCREF(
function);
9783 __Pyx_DECREF_SET(__pyx_t_4,
function);
9786 __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_v_p) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p);
9787 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9788 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1152, __pyx_L1_error)
9789 __Pyx_GOTREF(__pyx_t_3);
9790 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9791 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1152, __pyx_L1_error)
9792 __Pyx_GOTREF(__pyx_t_4);
9793 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9794 if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
9795 __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
9798 __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1152, __pyx_L1_error)
9799 __Pyx_GOTREF(__pyx_t_3);
9800 __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1152, __pyx_L1_error)
9802 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9804 if (likely(!__pyx_t_10)) {
9805 if (likely(PyList_CheckExact(__pyx_t_3))) {
9806 if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3))
break;
9807 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9808 __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++;
if (unlikely(0 < 0)) __PYX_ERR(0, 1152, __pyx_L1_error)
9810 __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1152, __pyx_L1_error)
9811 __Pyx_GOTREF(__pyx_t_4);
9814 if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
9815 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9816 __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++;
if (unlikely(0 < 0)) __PYX_ERR(0, 1152, __pyx_L1_error)
9818 __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++;
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1152, __pyx_L1_error)
9819 __Pyx_GOTREF(__pyx_t_4);
9823 __pyx_t_4 = __pyx_t_10(__pyx_t_3);
9824 if (unlikely(!__pyx_t_4)) {
9825 PyObject* exc_type = PyErr_Occurred();
9827 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9828 else __PYX_ERR(0, 1152, __pyx_L1_error)
9832 __Pyx_GOTREF(__pyx_t_4);
9834 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
9844 __Pyx_TraceLine(1153,0,__PYX_ERR(0, 1153, __pyx_L1_error))
9845 if (unlikely(!__pyx_v_OpE)) { __Pyx_RaiseUnboundLocalError(
"OpE"); __PYX_ERR(0, 1153, __pyx_L1_error) }
9846 __pyx_t_4 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_A, __pyx_v_OpE);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1153, __pyx_L1_error)
9847 __Pyx_GOTREF(__pyx_t_4);
9848 __Pyx_XDECREF_SET(__pyx_v_OpE, __pyx_t_4);
9858 __Pyx_TraceLine(1152,0,__PYX_ERR(0, 1152, __pyx_L1_error))
9860 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9879 __Pyx_TraceLine(1155,0,__PYX_ERR(0, 1155, __pyx_L1_error))
9880 __Pyx_XDECREF(__pyx_r);
9881 if (unlikely(!__pyx_v_OpE)) { __Pyx_RaiseUnboundLocalError(
"OpE"); __PYX_ERR(0, 1155, __pyx_L1_error) }
9882 __Pyx_INCREF(__pyx_v_OpE);
9883 __pyx_r = __pyx_v_OpE;
9896 __Pyx_XDECREF(__pyx_t_3);
9897 __Pyx_XDECREF(__pyx_t_4);
9898 __Pyx_XDECREF(__pyx_t_5);
9899 __Pyx_XDECREF(__pyx_t_6);
9900 __Pyx_XDECREF(__pyx_t_8);
9901 __Pyx_AddTraceback(
"imate.traceinv._hutchinson_method._operator_dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
9904 __Pyx_XDECREF(__pyx_v_BE);
9905 __Pyx_XDECREF(__pyx_v_OpE);
9906 __Pyx_XDECREF(__pyx_v_i);
9907 __Pyx_XDECREF(__pyx_v_AinvpE);
9908 __Pyx_XGIVEREF(__pyx_r);
9909 __Pyx_TraceReturn(__pyx_r, 0);
9910 __Pyx_RefNannyFinishContext();
9923 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
9924 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9925 PyObject *__pyx_v_shape = 0;
9926 Py_ssize_t __pyx_v_itemsize;
9927 PyObject *__pyx_v_format = 0;
9928 PyObject *__pyx_v_mode = 0;
9929 int __pyx_v_allocate_buffer;
9930 int __pyx_lineno = 0;
9931 const char *__pyx_filename = NULL;
9932 int __pyx_clineno = 0;
9934 __Pyx_RefNannyDeclarations
9935 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
9937 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
9938 PyObject* values[5] = {0,0,0,0,0};
9939 values[3] = ((PyObject *)__pyx_n_s_c);
9940 if (unlikely(__pyx_kwds)) {
9942 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9944 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9946 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9948 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9950 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9952 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9955 default:
goto __pyx_L5_argtuple_error;
9957 kw_args = PyDict_Size(__pyx_kwds);
9960 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
9961 else goto __pyx_L5_argtuple_error;
9964 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
9966 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 123, __pyx_L3_error)
9970 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
9972 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 123, __pyx_L3_error)
9977 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
9978 if (value) { values[3] = value; kw_args--; }
9983 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
9984 if (value) { values[4] = value; kw_args--; }
9987 if (unlikely(kw_args > 0)) {
9988 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 123, __pyx_L3_error)
9991 switch (PyTuple_GET_SIZE(__pyx_args)) {
9992 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9994 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9996 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9997 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9998 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10000 default:
goto __pyx_L5_argtuple_error;
10003 __pyx_v_shape = ((PyObject*)values[0]);
10004 __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]);
if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
10005 __pyx_v_format = values[2];
10006 __pyx_v_mode = values[3];
10008 __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]);
if (unlikely((__pyx_v_allocate_buffer == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 124, __pyx_L3_error)
10018 __pyx_v_allocate_buffer = ((int)1);
10021 goto __pyx_L4_argument_unpacking_done;
10022 __pyx_L5_argtuple_error:;
10023 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 123, __pyx_L3_error)
10025 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10026 __Pyx_RefNannyFinishContext();
10028 __pyx_L4_argument_unpacking_done:;
10029 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1,
"shape", 1))) __PYX_ERR(1, 123, __pyx_L1_error)
10030 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
10031 PyErr_Format(PyExc_TypeError,
"Argument '%.200s' must not be None",
"format"); __PYX_ERR(1, 123, __pyx_L1_error)
10033 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((
struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
10048 __Pyx_RefNannyFinishContext();
10052 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer) {
10054 Py_ssize_t __pyx_v_i;
10055 Py_ssize_t __pyx_v_dim;
10056 PyObject **__pyx_v_p;
10057 char __pyx_v_order;
10059 __Pyx_TraceDeclarations
10060 __Pyx_RefNannyDeclarations
10061 Py_ssize_t __pyx_t_1;
10063 PyObject *__pyx_t_3 = NULL;
10065 PyObject *__pyx_t_5 = NULL;
10066 PyObject *__pyx_t_6 = NULL;
10069 Py_ssize_t __pyx_t_9;
10070 PyObject *__pyx_t_10 = NULL;
10071 Py_ssize_t __pyx_t_11;
10072 int __pyx_lineno = 0;
10073 const char *__pyx_filename = NULL;
10074 int __pyx_clineno = 0;
10075 __Pyx_RefNannySetupContext(
"__cinit__", 0);
10076 __Pyx_TraceCall(
"__cinit__", __pyx_f[1], 123, 0, __PYX_ERR(1, 123, __pyx_L1_error));
10077 __Pyx_INCREF(__pyx_v_format);
10086 __Pyx_TraceLine(130,0,__PYX_ERR(1, 130, __pyx_L1_error))
10087 if (unlikely(__pyx_v_shape == Py_None)) {
10088 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
10089 __PYX_ERR(1, 130, __pyx_L1_error)
10091 __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape);
if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 130, __pyx_L1_error)
10092 __pyx_v_self->ndim = ((int)__pyx_t_1);
10101 __Pyx_TraceLine(131,0,__PYX_ERR(1, 131, __pyx_L1_error))
10102 __pyx_v_self->itemsize = __pyx_v_itemsize;
10111 __Pyx_TraceLine(133,0,__PYX_ERR(1, 133, __pyx_L1_error))
10112 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
10113 if (unlikely(__pyx_t_2)) {
10122 __Pyx_TraceLine(134,0,__PYX_ERR(1, 134, __pyx_L1_error))
10123 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 134, __pyx_L1_error)
10124 __Pyx_GOTREF(__pyx_t_3);
10125 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10126 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10127 __PYX_ERR(1, 134, __pyx_L1_error)
10145 __Pyx_TraceLine(136,0,__PYX_ERR(1, 136, __pyx_L1_error))
10146 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
10147 if (unlikely(__pyx_t_2)) {
10156 __Pyx_TraceLine(137,0,__PYX_ERR(1, 137, __pyx_L1_error))
10157 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 137, __pyx_L1_error)
10158 __Pyx_GOTREF(__pyx_t_3);
10159 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10160 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10161 __PYX_ERR(1, 137, __pyx_L1_error)
10179 __Pyx_TraceLine(139,0,__PYX_ERR(1, 139, __pyx_L1_error))
10180 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
10181 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
10191 __Pyx_TraceLine(140,0,__PYX_ERR(1, 140, __pyx_L1_error))
10192 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 140, __pyx_L1_error)
10193 __Pyx_GOTREF(__pyx_t_5);
10195 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
10196 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
10197 if (likely(__pyx_t_6)) {
10198 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
10199 __Pyx_INCREF(__pyx_t_6);
10200 __Pyx_INCREF(
function);
10201 __Pyx_DECREF_SET(__pyx_t_5,
function);
10204 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
10205 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10206 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 140, __pyx_L1_error)
10207 __Pyx_GOTREF(__pyx_t_3);
10208 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10209 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
10228 __Pyx_TraceLine(141,0,__PYX_ERR(1, 141, __pyx_L1_error))
10229 if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 141, __pyx_L1_error)
10230 __pyx_t_3 = __pyx_v_format;
10231 __Pyx_INCREF(__pyx_t_3);
10232 __Pyx_GIVEREF(__pyx_t_3);
10233 __Pyx_GOTREF(__pyx_v_self->_format);
10234 __Pyx_DECREF(__pyx_v_self->_format);
10235 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
10245 __Pyx_TraceLine(142,0,__PYX_ERR(1, 142, __pyx_L1_error))
10246 if (unlikely(__pyx_v_self->_format == Py_None)) {
10247 PyErr_SetString(PyExc_TypeError,
"expected bytes, NoneType found");
10248 __PYX_ERR(1, 142, __pyx_L1_error)
10250 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format);
if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 142, __pyx_L1_error)
10251 __pyx_v_self->format = __pyx_t_7;
10260 __Pyx_TraceLine(145,0,__PYX_ERR(1, 145, __pyx_L1_error))
10261 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
10270 __Pyx_TraceLine(146,0,__PYX_ERR(1, 146, __pyx_L1_error))
10271 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
10280 __Pyx_TraceLine(148,0,__PYX_ERR(1, 148, __pyx_L1_error))
10281 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
10282 if (unlikely(__pyx_t_4)) {
10291 __Pyx_TraceLine(149,0,__PYX_ERR(1, 149, __pyx_L1_error))
10292 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 149, __pyx_L1_error)
10293 __Pyx_GOTREF(__pyx_t_3);
10294 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10295 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10296 __PYX_ERR(1, 149, __pyx_L1_error)
10314 __Pyx_TraceLine(152,0,__PYX_ERR(1, 152, __pyx_L1_error))
10316 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
10318 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
10319 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10320 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++;
if (unlikely(0 < 0)) __PYX_ERR(1, 152, __pyx_L1_error)
10322 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 152, __pyx_L1_error)
10323 __Pyx_GOTREF(__pyx_t_5);
10325 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 152, __pyx_L1_error)
10326 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10327 __pyx_v_dim = __pyx_t_9;
10328 __pyx_v_idx = __pyx_t_8;
10329 __pyx_t_8 = (__pyx_t_8 + 1);
10338 __Pyx_TraceLine(153,0,__PYX_ERR(1, 153, __pyx_L1_error))
10339 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
10340 if (unlikely(__pyx_t_4)) {
10349 __Pyx_TraceLine(154,0,__PYX_ERR(1, 154, __pyx_L1_error))
10350 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 154, __pyx_L1_error)
10351 __Pyx_GOTREF(__pyx_t_5);
10352 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 154, __pyx_L1_error)
10353 __Pyx_GOTREF(__pyx_t_6);
10354 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 154, __pyx_L1_error)
10355 __Pyx_GOTREF(__pyx_t_10);
10356 __Pyx_GIVEREF(__pyx_t_5);
10357 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
10358 __Pyx_GIVEREF(__pyx_t_6);
10359 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
10362 __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 154, __pyx_L1_error)
10363 __Pyx_GOTREF(__pyx_t_6);
10364 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10365 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 154, __pyx_L1_error)
10366 __Pyx_GOTREF(__pyx_t_10);
10367 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10368 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
10369 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10370 __PYX_ERR(1, 154, __pyx_L1_error)
10388 __Pyx_TraceLine(155,0,__PYX_ERR(1, 155, __pyx_L1_error))
10389 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
10398 __Pyx_TraceLine(152,0,__PYX_ERR(1, 152, __pyx_L1_error))
10400 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10409 __Pyx_TraceLine(158,0,__PYX_ERR(1, 158, __pyx_L1_error))
10410 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 158, __pyx_L1_error)
10420 __Pyx_TraceLine(159,0,__PYX_ERR(1, 159, __pyx_L1_error))
10421 __pyx_v_order =
'F';
10430 __Pyx_TraceLine(160,0,__PYX_ERR(1, 160, __pyx_L1_error))
10431 __Pyx_INCREF(__pyx_n_u_fortran);
10432 __Pyx_GIVEREF(__pyx_n_u_fortran);
10433 __Pyx_GOTREF(__pyx_v_self->mode);
10434 __Pyx_DECREF(__pyx_v_self->mode);
10435 __pyx_v_self->mode = __pyx_n_u_fortran;
10454 __Pyx_TraceLine(161,0,__PYX_ERR(1, 161, __pyx_L1_error))
10455 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 161, __pyx_L1_error)
10456 if (likely(__pyx_t_4)) {
10465 __Pyx_TraceLine(162,0,__PYX_ERR(1, 162, __pyx_L1_error))
10466 __pyx_v_order =
'C';
10475 __Pyx_TraceLine(163,0,__PYX_ERR(1, 163, __pyx_L1_error))
10476 __Pyx_INCREF(__pyx_n_u_c);
10477 __Pyx_GIVEREF(__pyx_n_u_c);
10478 __Pyx_GOTREF(__pyx_v_self->mode);
10479 __Pyx_DECREF(__pyx_v_self->mode);
10480 __pyx_v_self->mode = __pyx_n_u_c;
10499 __Pyx_TraceLine(165,0,__PYX_ERR(1, 165, __pyx_L1_error))
10501 __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 165, __pyx_L1_error)
10502 __Pyx_GOTREF(__pyx_t_3);
10503 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 165, __pyx_L1_error)
10504 __Pyx_GOTREF(__pyx_t_10);
10505 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10506 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
10507 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10508 __PYX_ERR(1, 165, __pyx_L1_error)
10519 __Pyx_TraceLine(167,0,__PYX_ERR(1, 167, __pyx_L1_error))
10520 __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
10529 __Pyx_TraceLine(170,0,__PYX_ERR(1, 170, __pyx_L1_error))
10530 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
10539 __Pyx_TraceLine(171,0,__PYX_ERR(1, 171, __pyx_L1_error))
10540 __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 171, __pyx_L1_error)
10541 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 171, __pyx_L1_error)
10542 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10543 __pyx_v_self->dtype_is_object = __pyx_t_4;
10552 __Pyx_TraceLine(172,0,__PYX_ERR(1, 172, __pyx_L1_error))
10553 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
10563 __Pyx_TraceLine(175,0,__PYX_ERR(1, 175, __pyx_L1_error))
10564 __pyx_v_self->data = ((
char *)malloc(__pyx_v_self->len));
10573 __Pyx_TraceLine(176,0,__PYX_ERR(1, 176, __pyx_L1_error))
10574 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
10575 if (unlikely(__pyx_t_4)) {
10584 __Pyx_TraceLine(177,0,__PYX_ERR(1, 177, __pyx_L1_error))
10585 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__11, NULL);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 177, __pyx_L1_error)
10586 __Pyx_GOTREF(__pyx_t_10);
10587 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
10588 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10589 __PYX_ERR(1, 177, __pyx_L1_error)
10607 __Pyx_TraceLine(179,0,__PYX_ERR(1, 179, __pyx_L1_error))
10608 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
10618 __Pyx_TraceLine(180,0,__PYX_ERR(1, 180, __pyx_L1_error))
10619 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
10628 __Pyx_TraceLine(181,0,__PYX_ERR(1, 181, __pyx_L1_error))
10629 if (unlikely(__pyx_v_itemsize == 0)) {
10630 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
10631 __PYX_ERR(1, 181, __pyx_L1_error)
10633 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
10634 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
10635 __PYX_ERR(1, 181, __pyx_L1_error)
10637 __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
10638 __pyx_t_9 = __pyx_t_1;
10639 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
10640 __pyx_v_i = __pyx_t_11;
10649 __Pyx_TraceLine(182,0,__PYX_ERR(1, 182, __pyx_L1_error))
10650 (__pyx_v_p[__pyx_v_i]) = Py_None;
10659 __Pyx_TraceLine(183,0,__PYX_ERR(1, 183, __pyx_L1_error))
10660 Py_INCREF(Py_None);
10693 __Pyx_XDECREF(__pyx_t_3);
10694 __Pyx_XDECREF(__pyx_t_5);
10695 __Pyx_XDECREF(__pyx_t_6);
10696 __Pyx_XDECREF(__pyx_t_10);
10697 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10700 __Pyx_XDECREF(__pyx_v_format);
10701 __Pyx_TraceReturn(Py_None, 0);
10702 __Pyx_RefNannyFinishContext();
10715 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
10716 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
10718 __Pyx_RefNannyDeclarations
10719 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
10720 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((
struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
10723 __Pyx_RefNannyFinishContext();
10727 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
10728 int __pyx_v_bufmode;
10730 __Pyx_TraceDeclarations
10731 __Pyx_RefNannyDeclarations
10734 PyObject *__pyx_t_3 = NULL;
10736 Py_ssize_t __pyx_t_5;
10738 Py_ssize_t *__pyx_t_7;
10739 int __pyx_lineno = 0;
10740 const char *__pyx_filename = NULL;
10741 int __pyx_clineno = 0;
10742 if (__pyx_v_info == NULL) {
10743 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
10746 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
10747 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
10748 __Pyx_GIVEREF(__pyx_v_info->obj);
10749 __Pyx_TraceCall(
"__getbuffer__", __pyx_f[1], 186, 0, __PYX_ERR(1, 186, __pyx_L1_error));
10758 __Pyx_TraceLine(187,0,__PYX_ERR(1, 187, __pyx_L1_error))
10759 __pyx_v_bufmode = -1;
10768 __Pyx_TraceLine(188,0,__PYX_ERR(1, 188, __pyx_L1_error))
10769 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 188, __pyx_L1_error)
10770 __pyx_t_2 = (__pyx_t_1 != 0);
10780 __Pyx_TraceLine(189,0,__PYX_ERR(1, 189, __pyx_L1_error))
10781 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
10800 __Pyx_TraceLine(190,0,__PYX_ERR(1, 190, __pyx_L1_error))
10801 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 190, __pyx_L1_error)
10802 __pyx_t_1 = (__pyx_t_2 != 0);
10812 __Pyx_TraceLine(191,0,__PYX_ERR(1, 191, __pyx_L1_error))
10813 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
10832 __Pyx_TraceLine(192,0,__PYX_ERR(1, 192, __pyx_L1_error))
10833 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
10834 if (unlikely(__pyx_t_1)) {
10843 __Pyx_TraceLine(193,0,__PYX_ERR(1, 193, __pyx_L1_error))
10844 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 193, __pyx_L1_error)
10845 __Pyx_GOTREF(__pyx_t_3);
10846 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10847 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10848 __PYX_ERR(1, 193, __pyx_L1_error)
10866 __Pyx_TraceLine(194,0,__PYX_ERR(1, 194, __pyx_L1_error))
10867 __pyx_t_4 = __pyx_v_self->data;
10868 __pyx_v_info->buf = __pyx_t_4;
10877 __Pyx_TraceLine(195,0,__PYX_ERR(1, 195, __pyx_L1_error))
10878 __pyx_t_5 = __pyx_v_self->len;
10879 __pyx_v_info->len = __pyx_t_5;
10888 __Pyx_TraceLine(196,0,__PYX_ERR(1, 196, __pyx_L1_error))
10889 __pyx_t_6 = __pyx_v_self->ndim;
10890 __pyx_v_info->ndim = __pyx_t_6;
10899 __Pyx_TraceLine(197,0,__PYX_ERR(1, 197, __pyx_L1_error))
10900 __pyx_t_7 = __pyx_v_self->_shape;
10901 __pyx_v_info->shape = __pyx_t_7;
10910 __Pyx_TraceLine(198,0,__PYX_ERR(1, 198, __pyx_L1_error))
10911 __pyx_t_7 = __pyx_v_self->_strides;
10912 __pyx_v_info->strides = __pyx_t_7;
10921 __Pyx_TraceLine(199,0,__PYX_ERR(1, 199, __pyx_L1_error))
10922 __pyx_v_info->suboffsets = NULL;
10931 __Pyx_TraceLine(200,0,__PYX_ERR(1, 200, __pyx_L1_error))
10932 __pyx_t_5 = __pyx_v_self->itemsize;
10933 __pyx_v_info->itemsize = __pyx_t_5;
10942 __Pyx_TraceLine(201,0,__PYX_ERR(1, 201, __pyx_L1_error))
10943 __pyx_v_info->readonly = 0;
10952 __Pyx_TraceLine(203,0,__PYX_ERR(1, 203, __pyx_L1_error))
10953 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10963 __Pyx_TraceLine(204,0,__PYX_ERR(1, 204, __pyx_L1_error))
10964 __pyx_t_4 = __pyx_v_self->format;
10965 __pyx_v_info->format = __pyx_t_4;
10984 __Pyx_TraceLine(206,0,__PYX_ERR(1, 206, __pyx_L1_error))
10986 __pyx_v_info->format = NULL;
10997 __Pyx_TraceLine(208,0,__PYX_ERR(1, 208, __pyx_L1_error))
10998 __Pyx_INCREF(((PyObject *)__pyx_v_self));
10999 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11000 __Pyx_GOTREF(__pyx_v_info->obj);
11001 __Pyx_DECREF(__pyx_v_info->obj);
11002 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
11016 __Pyx_XDECREF(__pyx_t_3);
11017 __Pyx_AddTraceback(
"View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11019 if (__pyx_v_info->obj != NULL) {
11020 __Pyx_GOTREF(__pyx_v_info->obj);
11021 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11025 if (__pyx_v_info->obj == Py_None) {
11026 __Pyx_GOTREF(__pyx_v_info->obj);
11027 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11030 __Pyx_TraceReturn(Py_None, 0);
11031 __Pyx_RefNannyFinishContext();
11044 static void __pyx_array___dealloc__(PyObject *__pyx_v_self);
11045 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
11046 __Pyx_RefNannyDeclarations
11047 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
11048 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((
struct __pyx_array_obj *)__pyx_v_self));
11051 __Pyx_RefNannyFinishContext();
11054 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self) {
11055 __Pyx_TraceDeclarations
11056 __Pyx_RefNannyDeclarations
11058 int __pyx_lineno = 0;
11059 const char *__pyx_filename = NULL;
11060 int __pyx_clineno = 0;
11061 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
11062 __Pyx_TraceCall(
"__dealloc__", __pyx_f[1], 212, 0, __PYX_ERR(1, 212, __pyx_L1_error));
11071 __Pyx_TraceLine(213,0,__PYX_ERR(1, 213, __pyx_L1_error))
11072 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
11082 __Pyx_TraceLine(214,0,__PYX_ERR(1, 214, __pyx_L1_error))
11083 __pyx_v_self->callback_free_data(__pyx_v_self->data);
11102 __Pyx_TraceLine(215,0,__PYX_ERR(1, 215, __pyx_L1_error))
11103 __pyx_t_1 = (__pyx_v_self->free_data != 0);
11113 __Pyx_TraceLine(216,0,__PYX_ERR(1, 216, __pyx_L1_error))
11114 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
11124 __Pyx_TraceLine(217,0,__PYX_ERR(1, 217, __pyx_L1_error))
11125 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
11143 __Pyx_TraceLine(219,0,__PYX_ERR(1, 219, __pyx_L1_error))
11144 free(__pyx_v_self->data);
11163 __Pyx_TraceLine(220,0,__PYX_ERR(1, 220, __pyx_L1_error))
11164 PyObject_Free(__pyx_v_self->_shape);
11177 __Pyx_WriteUnraisable(
"View.MemoryView.array.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
11179 __Pyx_TraceReturn(Py_None, 0);
11180 __Pyx_RefNannyFinishContext();
11192 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self);
11193 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
11194 PyObject *__pyx_r = 0;
11195 __Pyx_RefNannyDeclarations
11196 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11197 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((
struct __pyx_array_obj *)__pyx_v_self));
11200 __Pyx_RefNannyFinishContext();
11204 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self) {
11205 PyObject *__pyx_r = NULL;
11206 __Pyx_TraceDeclarations
11207 __Pyx_RefNannyDeclarations
11208 PyObject *__pyx_t_1 = NULL;
11209 int __pyx_lineno = 0;
11210 const char *__pyx_filename = NULL;
11211 int __pyx_clineno = 0;
11212 __Pyx_RefNannySetupContext(
"__get__", 0);
11213 __Pyx_TraceCall(
"__get__", __pyx_f[1], 223, 0, __PYX_ERR(1, 223, __pyx_L1_error));
11222 __Pyx_TraceLine(224,0,__PYX_ERR(1, 224, __pyx_L1_error))
11223 __Pyx_XDECREF(__pyx_r);
11224 __pyx_t_1 = ((
struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error)
11225 __Pyx_GOTREF(__pyx_t_1);
11226 __pyx_r = __pyx_t_1;
11240 __Pyx_XDECREF(__pyx_t_1);
11241 __Pyx_AddTraceback(
"View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11244 __Pyx_XGIVEREF(__pyx_r);
11245 __Pyx_TraceReturn(__pyx_r, 0);
11246 __Pyx_RefNannyFinishContext();
11258 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self) {
11260 PyObject *__pyx_r = NULL;
11261 __Pyx_TraceDeclarations
11262 __Pyx_RefNannyDeclarations
11263 PyObject *__pyx_t_1 = NULL;
11264 PyObject *__pyx_t_2 = NULL;
11265 PyObject *__pyx_t_3 = NULL;
11266 int __pyx_lineno = 0;
11267 const char *__pyx_filename = NULL;
11268 int __pyx_clineno = 0;
11269 __Pyx_RefNannySetupContext(
"get_memview", 0);
11270 __Pyx_TraceCall(
"get_memview", __pyx_f[1], 227, 0, __PYX_ERR(1, 227, __pyx_L1_error));
11279 __Pyx_TraceLine(228,0,__PYX_ERR(1, 228, __pyx_L1_error))
11280 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
11289 __Pyx_TraceLine(229,0,__PYX_ERR(1, 229, __pyx_L1_error))
11290 __Pyx_XDECREF(__pyx_r);
11291 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 229, __pyx_L1_error)
11292 __Pyx_GOTREF(__pyx_t_1);
11293 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 229, __pyx_L1_error)
11294 __Pyx_GOTREF(__pyx_t_2);
11295 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error)
11296 __Pyx_GOTREF(__pyx_t_3);
11297 __Pyx_INCREF(((PyObject *)__pyx_v_self));
11298 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11299 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
11300 __Pyx_GIVEREF(__pyx_t_1);
11301 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
11302 __Pyx_GIVEREF(__pyx_t_2);
11303 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
11306 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 229, __pyx_L1_error)
11307 __Pyx_GOTREF(__pyx_t_2);
11308 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11309 __pyx_r = __pyx_t_2;
11323 __Pyx_XDECREF(__pyx_t_1);
11324 __Pyx_XDECREF(__pyx_t_2);
11325 __Pyx_XDECREF(__pyx_t_3);
11326 __Pyx_AddTraceback(
"View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
11329 __Pyx_XGIVEREF(__pyx_r);
11330 __Pyx_TraceReturn(__pyx_r, 0);
11331 __Pyx_RefNannyFinishContext();
11344 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self);
11345 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
11346 Py_ssize_t __pyx_r;
11347 __Pyx_RefNannyDeclarations
11348 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
11349 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((
struct __pyx_array_obj *)__pyx_v_self));
11352 __Pyx_RefNannyFinishContext();
11356 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self) {
11357 Py_ssize_t __pyx_r;
11358 __Pyx_TraceDeclarations
11359 __Pyx_RefNannyDeclarations
11360 int __pyx_lineno = 0;
11361 const char *__pyx_filename = NULL;
11362 int __pyx_clineno = 0;
11363 __Pyx_RefNannySetupContext(
"__len__", 0);
11364 __Pyx_TraceCall(
"__len__", __pyx_f[1], 231, 0, __PYX_ERR(1, 231, __pyx_L1_error));
11373 __Pyx_TraceLine(232,0,__PYX_ERR(1, 232, __pyx_L1_error))
11374 __pyx_r = (__pyx_v_self->_shape[0]);
11387 __Pyx_AddTraceback(
"View.MemoryView.array.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11390 __Pyx_TraceReturn(Py_None, 0);
11391 __Pyx_RefNannyFinishContext();
11404 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr);
11405 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
11406 PyObject *__pyx_r = 0;
11407 __Pyx_RefNannyDeclarations
11408 __Pyx_RefNannySetupContext(
"__getattr__ (wrapper)", 0);
11409 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
11412 __Pyx_RefNannyFinishContext();
11416 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
11417 PyObject *__pyx_r = NULL;
11418 __Pyx_TraceDeclarations
11419 __Pyx_RefNannyDeclarations
11420 PyObject *__pyx_t_1 = NULL;
11421 PyObject *__pyx_t_2 = NULL;
11422 int __pyx_lineno = 0;
11423 const char *__pyx_filename = NULL;
11424 int __pyx_clineno = 0;
11425 __Pyx_RefNannySetupContext(
"__getattr__", 0);
11426 __Pyx_TraceCall(
"__getattr__", __pyx_f[1], 234, 0, __PYX_ERR(1, 234, __pyx_L1_error));
11435 __Pyx_TraceLine(235,0,__PYX_ERR(1, 235, __pyx_L1_error))
11436 __Pyx_XDECREF(__pyx_r);
11437 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error)
11438 __Pyx_GOTREF(__pyx_t_1);
11439 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error)
11440 __Pyx_GOTREF(__pyx_t_2);
11441 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11442 __pyx_r = __pyx_t_2;
11456 __Pyx_XDECREF(__pyx_t_1);
11457 __Pyx_XDECREF(__pyx_t_2);
11458 __Pyx_AddTraceback(
"View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11461 __Pyx_XGIVEREF(__pyx_r);
11462 __Pyx_TraceReturn(__pyx_r, 0);
11463 __Pyx_RefNannyFinishContext();
11476 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item);
11477 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
11478 PyObject *__pyx_r = 0;
11479 __Pyx_RefNannyDeclarations
11480 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
11481 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
11484 __Pyx_RefNannyFinishContext();
11488 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
11489 PyObject *__pyx_r = NULL;
11490 __Pyx_TraceDeclarations
11491 __Pyx_RefNannyDeclarations
11492 PyObject *__pyx_t_1 = NULL;
11493 PyObject *__pyx_t_2 = NULL;
11494 int __pyx_lineno = 0;
11495 const char *__pyx_filename = NULL;
11496 int __pyx_clineno = 0;
11497 __Pyx_RefNannySetupContext(
"__getitem__", 0);
11498 __Pyx_TraceCall(
"__getitem__", __pyx_f[1], 237, 0, __PYX_ERR(1, 237, __pyx_L1_error));
11507 __Pyx_TraceLine(238,0,__PYX_ERR(1, 238, __pyx_L1_error))
11508 __Pyx_XDECREF(__pyx_r);
11509 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error)
11510 __Pyx_GOTREF(__pyx_t_1);
11511 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 238, __pyx_L1_error)
11512 __Pyx_GOTREF(__pyx_t_2);
11513 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11514 __pyx_r = __pyx_t_2;
11528 __Pyx_XDECREF(__pyx_t_1);
11529 __Pyx_XDECREF(__pyx_t_2);
11530 __Pyx_AddTraceback(
"View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11533 __Pyx_XGIVEREF(__pyx_r);
11534 __Pyx_TraceReturn(__pyx_r, 0);
11535 __Pyx_RefNannyFinishContext();
11548 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
11549 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
11551 __Pyx_RefNannyDeclarations
11552 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
11553 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
11556 __Pyx_RefNannyFinishContext();
11560 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
11562 __Pyx_TraceDeclarations
11563 __Pyx_RefNannyDeclarations
11564 PyObject *__pyx_t_1 = NULL;
11565 int __pyx_lineno = 0;
11566 const char *__pyx_filename = NULL;
11567 int __pyx_clineno = 0;
11568 __Pyx_RefNannySetupContext(
"__setitem__", 0);
11569 __Pyx_TraceCall(
"__setitem__", __pyx_f[1], 240, 0, __PYX_ERR(1, 240, __pyx_L1_error));
11578 __Pyx_TraceLine(241,0,__PYX_ERR(1, 241, __pyx_L1_error))
11579 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 241, __pyx_L1_error)
11580 __Pyx_GOTREF(__pyx_t_1);
11581 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 241, __pyx_L1_error)
11582 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11596 __Pyx_XDECREF(__pyx_t_1);
11597 __Pyx_AddTraceback(
"View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11600 __Pyx_TraceReturn(Py_None, 0);
11601 __Pyx_RefNannyFinishContext();
11612 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
11613 static PyMethodDef __pyx_mdef___pyx_array_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0};
11614 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11615 PyObject *__pyx_r = 0;
11616 __Pyx_RefNannyDeclarations
11617 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
11618 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((
struct __pyx_array_obj *)__pyx_v_self));
11621 __Pyx_RefNannyFinishContext();
11625 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self) {
11626 PyObject *__pyx_r = NULL;
11627 __Pyx_TraceDeclarations
11628 __Pyx_RefNannyDeclarations
11629 PyObject *__pyx_t_1 = NULL;
11630 int __pyx_lineno = 0;
11631 const char *__pyx_filename = NULL;
11632 int __pyx_clineno = 0;
11633 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
11634 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
11642 __Pyx_TraceLine(2,0,__PYX_ERR(1, 2, __pyx_L1_error))
11643 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
11644 __Pyx_GOTREF(__pyx_t_1);
11645 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11646 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11647 __PYX_ERR(1, 2, __pyx_L1_error)
11657 __Pyx_XDECREF(__pyx_t_1);
11658 __Pyx_AddTraceback(
"View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11660 __Pyx_XGIVEREF(__pyx_r);
11661 __Pyx_TraceReturn(__pyx_r, 0);
11662 __Pyx_RefNannyFinishContext();
11674 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
11675 static PyMethodDef __pyx_mdef___pyx_array_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0};
11676 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11677 PyObject *__pyx_r = 0;
11678 __Pyx_RefNannyDeclarations
11679 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
11680 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
11683 __Pyx_RefNannyFinishContext();
11687 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
11688 PyObject *__pyx_r = NULL;
11689 __Pyx_TraceDeclarations
11690 __Pyx_RefNannyDeclarations
11691 PyObject *__pyx_t_1 = NULL;
11692 int __pyx_lineno = 0;
11693 const char *__pyx_filename = NULL;
11694 int __pyx_clineno = 0;
11695 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
11696 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
11703 __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
11704 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
11705 __Pyx_GOTREF(__pyx_t_1);
11706 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11707 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11708 __PYX_ERR(1, 4, __pyx_L1_error)
11719 __Pyx_XDECREF(__pyx_t_1);
11720 __Pyx_AddTraceback(
"View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11722 __Pyx_XGIVEREF(__pyx_r);
11723 __Pyx_TraceReturn(__pyx_r, 0);
11724 __Pyx_RefNannyFinishContext();
11736 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize,
char *__pyx_v_format,
char *__pyx_v_mode,
char *__pyx_v_buf) {
11737 struct __pyx_array_obj *__pyx_v_result = 0;
11738 struct __pyx_array_obj *__pyx_r = NULL;
11739 __Pyx_TraceDeclarations
11740 __Pyx_RefNannyDeclarations
11742 PyObject *__pyx_t_2 = NULL;
11743 PyObject *__pyx_t_3 = NULL;
11744 PyObject *__pyx_t_4 = NULL;
11745 PyObject *__pyx_t_5 = NULL;
11746 int __pyx_lineno = 0;
11747 const char *__pyx_filename = NULL;
11748 int __pyx_clineno = 0;
11749 __Pyx_RefNannySetupContext(
"array_cwrapper", 0);
11750 __Pyx_TraceCall(
"array_cwrapper", __pyx_f[1], 245, 0, __PYX_ERR(1, 245, __pyx_L1_error));
11759 __Pyx_TraceLine(249,0,__PYX_ERR(1, 249, __pyx_L1_error))
11760 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
11770 __Pyx_TraceLine(250,0,__PYX_ERR(1, 250, __pyx_L1_error))
11771 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 250, __pyx_L1_error)
11772 __Pyx_GOTREF(__pyx_t_2);
11773 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 250, __pyx_L1_error)
11774 __Pyx_GOTREF(__pyx_t_3);
11775 __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 250, __pyx_L1_error)
11776 __Pyx_GOTREF(__pyx_t_4);
11777 __pyx_t_5 = PyTuple_New(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 250, __pyx_L1_error)
11778 __Pyx_GOTREF(__pyx_t_5);
11779 __Pyx_INCREF(__pyx_v_shape);
11780 __Pyx_GIVEREF(__pyx_v_shape);
11781 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
11782 __Pyx_GIVEREF(__pyx_t_2);
11783 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
11784 __Pyx_GIVEREF(__pyx_t_3);
11785 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
11786 __Pyx_GIVEREF(__pyx_t_4);
11787 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
11791 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 250, __pyx_L1_error)
11792 __Pyx_GOTREF(__pyx_t_4);
11793 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11794 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_4);
11814 __Pyx_TraceLine(252,0,__PYX_ERR(1, 252, __pyx_L1_error))
11816 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 252, __pyx_L1_error)
11817 __Pyx_GOTREF(__pyx_t_4);
11818 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 252, __pyx_L1_error)
11819 __Pyx_GOTREF(__pyx_t_5);
11820 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
11821 __Pyx_GOTREF(__pyx_t_3);
11822 __pyx_t_2 = PyTuple_New(4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 252, __pyx_L1_error)
11823 __Pyx_GOTREF(__pyx_t_2);
11824 __Pyx_INCREF(__pyx_v_shape);
11825 __Pyx_GIVEREF(__pyx_v_shape);
11826 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
11827 __Pyx_GIVEREF(__pyx_t_4);
11828 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
11829 __Pyx_GIVEREF(__pyx_t_5);
11830 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
11831 __Pyx_GIVEREF(__pyx_t_3);
11832 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
11844 __Pyx_TraceLine(253,0,__PYX_ERR(1, 253, __pyx_L1_error))
11845 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 253, __pyx_L1_error)
11846 __Pyx_GOTREF(__pyx_t_3);
11847 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 253, __pyx_L1_error)
11856 __Pyx_TraceLine(252,0,__PYX_ERR(1, 252, __pyx_L1_error))
11857 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 252, __pyx_L1_error)
11858 __Pyx_GOTREF(__pyx_t_5);
11859 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11860 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11861 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_5);
11871 __Pyx_TraceLine(254,0,__PYX_ERR(1, 254, __pyx_L1_error))
11872 __pyx_v_result->data = __pyx_v_buf;
11883 __Pyx_TraceLine(256,0,__PYX_ERR(1, 256, __pyx_L1_error))
11884 __Pyx_XDECREF(((PyObject *)__pyx_r));
11885 __Pyx_INCREF(((PyObject *)__pyx_v_result));
11886 __pyx_r = __pyx_v_result;
11899 __Pyx_XDECREF(__pyx_t_2);
11900 __Pyx_XDECREF(__pyx_t_3);
11901 __Pyx_XDECREF(__pyx_t_4);
11902 __Pyx_XDECREF(__pyx_t_5);
11903 __Pyx_AddTraceback(
"View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
11906 __Pyx_XDECREF((PyObject *)__pyx_v_result);
11907 __Pyx_XGIVEREF((PyObject *)__pyx_r);
11908 __Pyx_TraceReturn(__pyx_r, 0);
11909 __Pyx_RefNannyFinishContext();
11922 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
11923 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11924 PyObject *__pyx_v_name = 0;
11925 int __pyx_lineno = 0;
11926 const char *__pyx_filename = NULL;
11927 int __pyx_clineno = 0;
11929 __Pyx_RefNannyDeclarations
11930 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
11932 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
11933 PyObject* values[1] = {0};
11934 if (unlikely(__pyx_kwds)) {
11935 Py_ssize_t kw_args;
11936 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11937 switch (pos_args) {
11938 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11939 CYTHON_FALLTHROUGH;
11941 default:
goto __pyx_L5_argtuple_error;
11943 kw_args = PyDict_Size(__pyx_kwds);
11944 switch (pos_args) {
11946 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
11947 else goto __pyx_L5_argtuple_error;
11949 if (unlikely(kw_args > 0)) {
11950 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(1, 282, __pyx_L3_error)
11952 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
11953 goto __pyx_L5_argtuple_error;
11955 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11957 __pyx_v_name = values[0];
11959 goto __pyx_L4_argument_unpacking_done;
11960 __pyx_L5_argtuple_error:;
11961 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 282, __pyx_L3_error)
11963 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11964 __Pyx_RefNannyFinishContext();
11966 __pyx_L4_argument_unpacking_done:;
11967 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
11970 __Pyx_RefNannyFinishContext();
11974 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
11976 __Pyx_TraceDeclarations
11977 __Pyx_RefNannyDeclarations
11978 int __pyx_lineno = 0;
11979 const char *__pyx_filename = NULL;
11980 int __pyx_clineno = 0;
11981 __Pyx_RefNannySetupContext(
"__init__", 0);
11982 __Pyx_TraceCall(
"__init__", __pyx_f[1], 282, 0, __PYX_ERR(1, 282, __pyx_L1_error));
11991 __Pyx_TraceLine(283,0,__PYX_ERR(1, 283, __pyx_L1_error))
11992 __Pyx_INCREF(__pyx_v_name);
11993 __Pyx_GIVEREF(__pyx_v_name);
11994 __Pyx_GOTREF(__pyx_v_self->name);
11995 __Pyx_DECREF(__pyx_v_self->name);
11996 __pyx_v_self->name = __pyx_v_name;
12010 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12013 __Pyx_TraceReturn(Py_None, 0);
12014 __Pyx_RefNannyFinishContext();
12027 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self);
12028 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
12029 PyObject *__pyx_r = 0;
12030 __Pyx_RefNannyDeclarations
12031 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
12032 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
12035 __Pyx_RefNannyFinishContext();
12039 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
12040 PyObject *__pyx_r = NULL;
12041 __Pyx_TraceDeclarations
12042 __Pyx_RefNannyDeclarations
12043 int __pyx_lineno = 0;
12044 const char *__pyx_filename = NULL;
12045 int __pyx_clineno = 0;
12046 __Pyx_RefNannySetupContext(
"__repr__", 0);
12047 __Pyx_TraceCall(
"__repr__", __pyx_f[1], 284, 0, __PYX_ERR(1, 284, __pyx_L1_error));
12056 __Pyx_TraceLine(285,0,__PYX_ERR(1, 285, __pyx_L1_error))
12057 __Pyx_XDECREF(__pyx_r);
12058 __Pyx_INCREF(__pyx_v_self->name);
12059 __pyx_r = __pyx_v_self->name;
12072 __Pyx_AddTraceback(
"View.MemoryView.Enum.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12075 __Pyx_XGIVEREF(__pyx_r);
12076 __Pyx_TraceReturn(__pyx_r, 0);
12077 __Pyx_RefNannyFinishContext();
12088 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12089 static PyMethodDef __pyx_mdef___pyx_MemviewEnum_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0};
12090 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12091 PyObject *__pyx_r = 0;
12092 __Pyx_RefNannyDeclarations
12093 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
12094 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
12097 __Pyx_RefNannyFinishContext();
12101 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
12102 PyObject *__pyx_v_state = 0;
12103 PyObject *__pyx_v__dict = 0;
12104 int __pyx_v_use_setstate;
12105 PyObject *__pyx_r = NULL;
12106 __Pyx_TraceDeclarations
12107 __Pyx_RefNannyDeclarations
12108 PyObject *__pyx_t_1 = NULL;
12111 PyObject *__pyx_t_4 = NULL;
12112 PyObject *__pyx_t_5 = NULL;
12113 int __pyx_lineno = 0;
12114 const char *__pyx_filename = NULL;
12115 int __pyx_clineno = 0;
12116 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
12117 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
12126 __Pyx_TraceLine(5,0,__PYX_ERR(1, 5, __pyx_L1_error))
12127 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
12128 __Pyx_GOTREF(__pyx_t_1);
12129 __Pyx_INCREF(__pyx_v_self->name);
12130 __Pyx_GIVEREF(__pyx_v_self->name);
12131 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
12132 __pyx_v_state = ((PyObject*)__pyx_t_1);
12142 __Pyx_TraceLine(6,0,__PYX_ERR(1, 6, __pyx_L1_error))
12143 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
12144 __Pyx_GOTREF(__pyx_t_1);
12145 __pyx_v__dict = __pyx_t_1;
12155 __Pyx_TraceLine(7,0,__PYX_ERR(1, 7, __pyx_L1_error))
12156 __pyx_t_2 = (__pyx_v__dict != Py_None);
12157 __pyx_t_3 = (__pyx_t_2 != 0);
12167 __Pyx_TraceLine(8,0,__PYX_ERR(1, 8, __pyx_L1_error))
12168 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
12169 __Pyx_GOTREF(__pyx_t_1);
12170 __Pyx_INCREF(__pyx_v__dict);
12171 __Pyx_GIVEREF(__pyx_v__dict);
12172 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
12173 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
12174 __Pyx_GOTREF(__pyx_t_4);
12175 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12176 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
12186 __Pyx_TraceLine(9,0,__PYX_ERR(1, 9, __pyx_L1_error))
12187 __pyx_v_use_setstate = 1;
12206 __Pyx_TraceLine(11,0,__PYX_ERR(1, 11, __pyx_L1_error))
12208 __pyx_t_3 = (__pyx_v_self->name != Py_None);
12209 __pyx_v_use_setstate = __pyx_t_3;
12220 __Pyx_TraceLine(12,0,__PYX_ERR(1, 12, __pyx_L1_error))
12221 __pyx_t_3 = (__pyx_v_use_setstate != 0);
12231 __Pyx_TraceLine(13,0,__PYX_ERR(1, 13, __pyx_L1_error))
12232 __Pyx_XDECREF(__pyx_r);
12233 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
12234 __Pyx_GOTREF(__pyx_t_4);
12235 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
12236 __Pyx_GOTREF(__pyx_t_1);
12237 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12238 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12239 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12240 __Pyx_INCREF(__pyx_int_184977713);
12241 __Pyx_GIVEREF(__pyx_int_184977713);
12242 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
12243 __Pyx_INCREF(Py_None);
12244 __Pyx_GIVEREF(Py_None);
12245 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
12246 __pyx_t_5 = PyTuple_New(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
12247 __Pyx_GOTREF(__pyx_t_5);
12248 __Pyx_GIVEREF(__pyx_t_4);
12249 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
12250 __Pyx_GIVEREF(__pyx_t_1);
12251 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
12252 __Pyx_INCREF(__pyx_v_state);
12253 __Pyx_GIVEREF(__pyx_v_state);
12254 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
12257 __pyx_r = __pyx_t_5;
12277 __Pyx_TraceLine(15,0,__PYX_ERR(1, 15, __pyx_L1_error))
12279 __Pyx_XDECREF(__pyx_r);
12280 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
12281 __Pyx_GOTREF(__pyx_t_5);
12282 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
12283 __Pyx_GOTREF(__pyx_t_1);
12284 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12285 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12286 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12287 __Pyx_INCREF(__pyx_int_184977713);
12288 __Pyx_GIVEREF(__pyx_int_184977713);
12289 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
12290 __Pyx_INCREF(__pyx_v_state);
12291 __Pyx_GIVEREF(__pyx_v_state);
12292 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
12293 __pyx_t_4 = PyTuple_New(2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
12294 __Pyx_GOTREF(__pyx_t_4);
12295 __Pyx_GIVEREF(__pyx_t_5);
12296 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
12297 __Pyx_GIVEREF(__pyx_t_1);
12298 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
12301 __pyx_r = __pyx_t_4;
12314 __Pyx_XDECREF(__pyx_t_1);
12315 __Pyx_XDECREF(__pyx_t_4);
12316 __Pyx_XDECREF(__pyx_t_5);
12317 __Pyx_AddTraceback(
"View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12320 __Pyx_XDECREF(__pyx_v_state);
12321 __Pyx_XDECREF(__pyx_v__dict);
12322 __Pyx_XGIVEREF(__pyx_r);
12323 __Pyx_TraceReturn(__pyx_r, 0);
12324 __Pyx_RefNannyFinishContext();
12336 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
12337 static PyMethodDef __pyx_mdef___pyx_MemviewEnum_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0};
12338 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
12339 PyObject *__pyx_r = 0;
12340 __Pyx_RefNannyDeclarations
12341 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
12342 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
12345 __Pyx_RefNannyFinishContext();
12349 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
12350 PyObject *__pyx_r = NULL;
12351 __Pyx_TraceDeclarations
12352 __Pyx_RefNannyDeclarations
12353 PyObject *__pyx_t_1 = NULL;
12354 int __pyx_lineno = 0;
12355 const char *__pyx_filename = NULL;
12356 int __pyx_clineno = 0;
12357 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
12358 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[1], 16, 0, __PYX_ERR(1, 16, __pyx_L1_error));
12365 __Pyx_TraceLine(17,0,__PYX_ERR(1, 17, __pyx_L1_error))
12366 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
12367 __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
12368 __Pyx_GOTREF(__pyx_t_1);
12369 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12379 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12382 __Pyx_XDECREF(__pyx_t_1);
12383 __Pyx_AddTraceback(
"View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12386 __Pyx_XGIVEREF(__pyx_r);
12387 __Pyx_TraceReturn(__pyx_r, 0);
12388 __Pyx_RefNannyFinishContext();
12400 static void *__pyx_align_pointer(
void *__pyx_v_memory,
size_t __pyx_v_alignment) {
12401 Py_intptr_t __pyx_v_aligned_p;
12402 size_t __pyx_v_offset;
12404 __Pyx_TraceDeclarations
12406 int __pyx_lineno = 0;
12407 const char *__pyx_filename = NULL;
12408 int __pyx_clineno = 0;
12409 __Pyx_TraceCall(
"align_pointer", __pyx_f[1], 299, 1, __PYX_ERR(1, 299, __pyx_L1_error));
12418 __Pyx_TraceLine(301,1,__PYX_ERR(1, 301, __pyx_L1_error))
12419 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
12428 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
12437 __Pyx_TraceLine(307,1,__PYX_ERR(1, 307, __pyx_L1_error))
12438 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
12448 __Pyx_TraceLine(308,1,__PYX_ERR(1, 308, __pyx_L1_error))
12449 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
12467 __Pyx_TraceLine(310,1,__PYX_ERR(1, 310, __pyx_L1_error))
12468 __pyx_r = ((
void *)__pyx_v_aligned_p);
12481 __Pyx_WriteUnraisable(
"View.MemoryView.align_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
12484 __Pyx_TraceReturn(Py_None, 1);
12497 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
12498 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12499 PyObject *__pyx_v_obj = 0;
12501 int __pyx_v_dtype_is_object;
12502 int __pyx_lineno = 0;
12503 const char *__pyx_filename = NULL;
12504 int __pyx_clineno = 0;
12506 __Pyx_RefNannyDeclarations
12507 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
12509 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
12510 PyObject* values[3] = {0,0,0};
12511 if (unlikely(__pyx_kwds)) {
12512 Py_ssize_t kw_args;
12513 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12514 switch (pos_args) {
12515 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12516 CYTHON_FALLTHROUGH;
12517 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12518 CYTHON_FALLTHROUGH;
12519 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12520 CYTHON_FALLTHROUGH;
12522 default:
goto __pyx_L5_argtuple_error;
12524 kw_args = PyDict_Size(__pyx_kwds);
12525 switch (pos_args) {
12527 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
12528 else goto __pyx_L5_argtuple_error;
12529 CYTHON_FALLTHROUGH;
12531 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
12533 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 346, __pyx_L3_error)
12535 CYTHON_FALLTHROUGH;
12538 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
12539 if (value) { values[2] = value; kw_args--; }
12542 if (unlikely(kw_args > 0)) {
12543 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 346, __pyx_L3_error)
12546 switch (PyTuple_GET_SIZE(__pyx_args)) {
12547 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12548 CYTHON_FALLTHROUGH;
12549 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12550 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12552 default:
goto __pyx_L5_argtuple_error;
12555 __pyx_v_obj = values[0];
12556 __pyx_v_flags = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_flags == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 346, __pyx_L3_error)
12558 __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]);
if (unlikely((__pyx_v_dtype_is_object == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 346, __pyx_L3_error)
12560 __pyx_v_dtype_is_object = ((int)0);
12563 goto __pyx_L4_argument_unpacking_done;
12564 __pyx_L5_argtuple_error:;
12565 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 346, __pyx_L3_error)
12567 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12568 __Pyx_RefNannyFinishContext();
12570 __pyx_L4_argument_unpacking_done:;
12571 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
12574 __Pyx_RefNannyFinishContext();
12578 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object) {
12580 __Pyx_TraceDeclarations
12581 __Pyx_RefNannyDeclarations
12586 int __pyx_lineno = 0;
12587 const char *__pyx_filename = NULL;
12588 int __pyx_clineno = 0;
12589 __Pyx_RefNannySetupContext(
"__cinit__", 0);
12590 __Pyx_TraceCall(
"__cinit__", __pyx_f[1], 346, 0, __PYX_ERR(1, 346, __pyx_L1_error));
12599 __Pyx_TraceLine(347,0,__PYX_ERR(1, 347, __pyx_L1_error))
12600 __Pyx_INCREF(__pyx_v_obj);
12601 __Pyx_GIVEREF(__pyx_v_obj);
12602 __Pyx_GOTREF(__pyx_v_self->obj);
12603 __Pyx_DECREF(__pyx_v_self->obj);
12604 __pyx_v_self->obj = __pyx_v_obj;
12613 __Pyx_TraceLine(348,0,__PYX_ERR(1, 348, __pyx_L1_error))
12614 __pyx_v_self->flags = __pyx_v_flags;
12623 __Pyx_TraceLine(349,0,__PYX_ERR(1, 349, __pyx_L1_error))
12624 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
12625 __pyx_t_3 = (__pyx_t_2 != 0);
12628 __pyx_t_1 = __pyx_t_3;
12629 goto __pyx_L4_bool_binop_done;
12631 __pyx_t_3 = (__pyx_v_obj != Py_None);
12632 __pyx_t_2 = (__pyx_t_3 != 0);
12633 __pyx_t_1 = __pyx_t_2;
12634 __pyx_L4_bool_binop_done:;
12644 __Pyx_TraceLine(350,0,__PYX_ERR(1, 350, __pyx_L1_error))
12645 __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 350, __pyx_L1_error)
12654 __Pyx_TraceLine(351,0,__PYX_ERR(1, 351, __pyx_L1_error))
12655 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
12665 __Pyx_TraceLine(352,0,__PYX_ERR(1, 352, __pyx_L1_error))
12666 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
12675 __Pyx_TraceLine(353,0,__PYX_ERR(1, 353, __pyx_L1_error))
12676 Py_INCREF(Py_None);
12703 __Pyx_TraceLine(355,0,__PYX_ERR(1, 355, __pyx_L1_error))
12704 __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0);
12714 __Pyx_TraceLine(357,0,__PYX_ERR(1, 357, __pyx_L1_error))
12715 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
12725 __Pyx_TraceLine(358,0,__PYX_ERR(1, 358, __pyx_L1_error))
12726 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
12735 __Pyx_TraceLine(359,0,__PYX_ERR(1, 359, __pyx_L1_error))
12736 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
12754 __Pyx_TraceLine(360,0,__PYX_ERR(1, 360, __pyx_L1_error))
12755 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
12765 __Pyx_TraceLine(361,0,__PYX_ERR(1, 361, __pyx_L1_error))
12766 __pyx_v_self->lock = PyThread_allocate_lock();
12775 __Pyx_TraceLine(362,0,__PYX_ERR(1, 362, __pyx_L1_error))
12776 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
12777 if (unlikely(__pyx_t_1)) {
12786 __Pyx_TraceLine(363,0,__PYX_ERR(1, 363, __pyx_L1_error))
12787 PyErr_NoMemory(); __PYX_ERR(1, 363, __pyx_L1_error)
12823 __Pyx_TraceLine(365,0,__PYX_ERR(1, 365, __pyx_L1_error))
12824 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
12834 __Pyx_TraceLine(366,0,__PYX_ERR(1, 366, __pyx_L1_error))
12835 __pyx_t_2 = (((__pyx_v_self->view.format[0]) ==
'O') != 0);
12838 __pyx_t_1 = __pyx_t_2;
12839 goto __pyx_L12_bool_binop_done;
12841 __pyx_t_2 = (((__pyx_v_self->view.format[1]) ==
'\x00') != 0);
12842 __pyx_t_1 = __pyx_t_2;
12843 __pyx_L12_bool_binop_done:;
12844 __pyx_v_self->dtype_is_object = __pyx_t_1;
12863 __Pyx_TraceLine(368,0,__PYX_ERR(1, 368, __pyx_L1_error))
12865 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
12876 __Pyx_TraceLine(370,0,__PYX_ERR(1, 370, __pyx_L1_error))
12877 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((
void *)(&(__pyx_v_self->acquisition_count[0]))), (
sizeof(__pyx_atomic_int))));
12886 __Pyx_TraceLine(372,0,__PYX_ERR(1, 372, __pyx_L1_error))
12887 __pyx_v_self->typeinfo = NULL;
12901 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12904 __Pyx_TraceReturn(Py_None, 0);
12905 __Pyx_RefNannyFinishContext();
12918 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self);
12919 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
12920 __Pyx_RefNannyDeclarations
12921 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
12922 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12925 __Pyx_RefNannyFinishContext();
12928 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12930 __Pyx_TraceDeclarations
12931 __Pyx_RefNannyDeclarations
12937 PyThread_type_lock __pyx_t_6;
12938 PyThread_type_lock __pyx_t_7;
12939 int __pyx_lineno = 0;
12940 const char *__pyx_filename = NULL;
12941 int __pyx_clineno = 0;
12942 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
12943 __Pyx_TraceCall(
"__dealloc__", __pyx_f[1], 374, 0, __PYX_ERR(1, 374, __pyx_L1_error));
12952 __Pyx_TraceLine(375,0,__PYX_ERR(1, 375, __pyx_L1_error))
12953 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
12954 __pyx_t_2 = (__pyx_t_1 != 0);
12964 __Pyx_TraceLine(376,0,__PYX_ERR(1, 376, __pyx_L1_error))
12965 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
12984 __Pyx_TraceLine(377,0,__PYX_ERR(1, 377, __pyx_L1_error))
12985 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
12995 __Pyx_TraceLine(379,0,__PYX_ERR(1, 379, __pyx_L1_error))
12996 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
13005 __Pyx_TraceLine(380,0,__PYX_ERR(1, 380, __pyx_L1_error))
13006 Py_DECREF(Py_None);
13025 __Pyx_TraceLine(384,0,__PYX_ERR(1, 384, __pyx_L1_error))
13026 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
13036 __Pyx_TraceLine(385,0,__PYX_ERR(1, 385, __pyx_L1_error))
13037 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
13038 __pyx_t_4 = __pyx_t_3;
13039 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
13040 __pyx_v_i = __pyx_t_5;
13049 __Pyx_TraceLine(386,0,__PYX_ERR(1, 386, __pyx_L1_error))
13050 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
13060 __Pyx_TraceLine(387,0,__PYX_ERR(1, 387, __pyx_L1_error))
13061 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
13070 __Pyx_TraceLine(388,0,__PYX_ERR(1, 388, __pyx_L1_error))
13071 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
13081 __Pyx_TraceLine(390,0,__PYX_ERR(1, 390, __pyx_L1_error))
13082 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
13083 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
13092 __Pyx_TraceLine(389,0,__PYX_ERR(1, 389, __pyx_L1_error))
13093 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
13094 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
13112 __Pyx_TraceLine(391,0,__PYX_ERR(1, 391, __pyx_L1_error))
13113 goto __pyx_L6_break;
13133 __Pyx_TraceLine(393,0,__PYX_ERR(1, 393, __pyx_L1_error))
13134 PyThread_free_lock(__pyx_v_self->lock);
13158 __Pyx_WriteUnraisable(
"View.MemoryView.memoryview.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
13160 __Pyx_TraceReturn(Py_None, 0);
13161 __Pyx_RefNannyFinishContext();
13172 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
13173 Py_ssize_t __pyx_v_dim;
13174 char *__pyx_v_itemp;
13175 PyObject *__pyx_v_idx = NULL;
13177 __Pyx_TraceDeclarations
13178 __Pyx_RefNannyDeclarations
13179 Py_ssize_t __pyx_t_1;
13180 PyObject *__pyx_t_2 = NULL;
13181 Py_ssize_t __pyx_t_3;
13182 PyObject *(*__pyx_t_4)(PyObject *);
13183 PyObject *__pyx_t_5 = NULL;
13184 Py_ssize_t __pyx_t_6;
13186 int __pyx_lineno = 0;
13187 const char *__pyx_filename = NULL;
13188 int __pyx_clineno = 0;
13189 __Pyx_RefNannySetupContext(
"get_item_pointer", 0);
13190 __Pyx_TraceCall(
"get_item_pointer", __pyx_f[1], 395, 0, __PYX_ERR(1, 395, __pyx_L1_error));
13199 __Pyx_TraceLine(397,0,__PYX_ERR(1, 397, __pyx_L1_error))
13200 __pyx_v_itemp = ((
char *)__pyx_v_self->view.buf);
13209 __Pyx_TraceLine(399,0,__PYX_ERR(1, 399, __pyx_L1_error))
13211 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
13212 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
13215 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 399, __pyx_L1_error)
13216 __Pyx_GOTREF(__pyx_t_2);
13217 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 399, __pyx_L1_error)
13220 if (likely(!__pyx_t_4)) {
13221 if (likely(PyList_CheckExact(__pyx_t_2))) {
13222 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2))
break;
13223 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13224 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 399, __pyx_L1_error)
13226 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 399, __pyx_L1_error)
13227 __Pyx_GOTREF(__pyx_t_5);
13230 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
13231 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13232 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 399, __pyx_L1_error)
13234 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 399, __pyx_L1_error)
13235 __Pyx_GOTREF(__pyx_t_5);
13239 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
13240 if (unlikely(!__pyx_t_5)) {
13241 PyObject* exc_type = PyErr_Occurred();
13243 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13244 else __PYX_ERR(1, 399, __pyx_L1_error)
13248 __Pyx_GOTREF(__pyx_t_5);
13250 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
13252 __pyx_v_dim = __pyx_t_1;
13253 __pyx_t_1 = (__pyx_t_1 + 1);
13262 __Pyx_TraceLine(400,0,__PYX_ERR(1, 400, __pyx_L1_error))
13263 __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx);
if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 400, __pyx_L1_error)
13264 __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim);
if (unlikely(__pyx_t_7 == ((
char *)NULL))) __PYX_ERR(1, 400, __pyx_L1_error)
13265 __pyx_v_itemp = __pyx_t_7;
13274 __Pyx_TraceLine(399,0,__PYX_ERR(1, 399, __pyx_L1_error))
13276 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13285 __Pyx_TraceLine(402,0,__PYX_ERR(1, 402, __pyx_L1_error))
13286 __pyx_r = __pyx_v_itemp;
13299 __Pyx_XDECREF(__pyx_t_2);
13300 __Pyx_XDECREF(__pyx_t_5);
13301 __Pyx_AddTraceback(
"View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
13304 __Pyx_XDECREF(__pyx_v_idx);
13305 __Pyx_TraceReturn(Py_None, 0);
13306 __Pyx_RefNannyFinishContext();
13319 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index);
13320 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
13321 PyObject *__pyx_r = 0;
13322 __Pyx_RefNannyDeclarations
13323 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
13324 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
13327 __Pyx_RefNannyFinishContext();
13331 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
13332 PyObject *__pyx_v_have_slices = NULL;
13333 PyObject *__pyx_v_indices = NULL;
13334 char *__pyx_v_itemp;
13335 PyObject *__pyx_r = NULL;
13336 __Pyx_TraceDeclarations
13337 __Pyx_RefNannyDeclarations
13340 PyObject *__pyx_t_3 = NULL;
13341 PyObject *__pyx_t_4 = NULL;
13342 PyObject *__pyx_t_5 = NULL;
13344 int __pyx_lineno = 0;
13345 const char *__pyx_filename = NULL;
13346 int __pyx_clineno = 0;
13347 __Pyx_RefNannySetupContext(
"__getitem__", 0);
13348 __Pyx_TraceCall(
"__getitem__", __pyx_f[1], 405, 0, __PYX_ERR(1, 405, __pyx_L1_error));
13357 __Pyx_TraceLine(406,0,__PYX_ERR(1, 406, __pyx_L1_error))
13358 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
13359 __pyx_t_2 = (__pyx_t_1 != 0);
13369 __Pyx_TraceLine(407,0,__PYX_ERR(1, 407, __pyx_L1_error))
13370 __Pyx_XDECREF(__pyx_r);
13371 __Pyx_INCREF(((PyObject *)__pyx_v_self));
13372 __pyx_r = ((PyObject *)__pyx_v_self);
13391 __Pyx_TraceLine(409,0,__PYX_ERR(1, 409, __pyx_L1_error))
13392 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 409, __pyx_L1_error)
13393 __Pyx_GOTREF(__pyx_t_3);
13394 if (likely(__pyx_t_3 != Py_None)) {
13395 PyObject* sequence = __pyx_t_3;
13396 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13397 if (unlikely(size != 2)) {
13398 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13399 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13400 __PYX_ERR(1, 409, __pyx_L1_error)
13402 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13403 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
13404 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
13405 __Pyx_INCREF(__pyx_t_4);
13406 __Pyx_INCREF(__pyx_t_5);
13408 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 409, __pyx_L1_error)
13409 __Pyx_GOTREF(__pyx_t_4);
13410 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 409, __pyx_L1_error)
13411 __Pyx_GOTREF(__pyx_t_5);
13413 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13415 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 409, __pyx_L1_error)
13417 __pyx_v_have_slices = __pyx_t_4;
13419 __pyx_v_indices = __pyx_t_5;
13429 __Pyx_TraceLine(412,0,__PYX_ERR(1, 412, __pyx_L1_error))
13430 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 412, __pyx_L1_error)
13440 __Pyx_TraceLine(413,0,__PYX_ERR(1, 413, __pyx_L1_error))
13441 __Pyx_XDECREF(__pyx_r);
13442 __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 413, __pyx_L1_error)
13443 __Pyx_GOTREF(__pyx_t_3);
13444 __pyx_r = __pyx_t_3;
13464 __Pyx_TraceLine(415,0,__PYX_ERR(1, 415, __pyx_L1_error))
13466 __pyx_t_6 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices);
if (unlikely(__pyx_t_6 == ((
char *)NULL))) __PYX_ERR(1, 415, __pyx_L1_error)
13467 __pyx_v_itemp = __pyx_t_6;
13476 __Pyx_TraceLine(416,0,__PYX_ERR(1, 416, __pyx_L1_error))
13477 __Pyx_XDECREF(__pyx_r);
13478 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 416, __pyx_L1_error)
13479 __Pyx_GOTREF(__pyx_t_3);
13480 __pyx_r = __pyx_t_3;
13495 __Pyx_XDECREF(__pyx_t_3);
13496 __Pyx_XDECREF(__pyx_t_4);
13497 __Pyx_XDECREF(__pyx_t_5);
13498 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13501 __Pyx_XDECREF(__pyx_v_have_slices);
13502 __Pyx_XDECREF(__pyx_v_indices);
13503 __Pyx_XGIVEREF(__pyx_r);
13504 __Pyx_TraceReturn(__pyx_r, 0);
13505 __Pyx_RefNannyFinishContext();
13518 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
13519 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
13521 __Pyx_RefNannyDeclarations
13522 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
13523 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
13526 __Pyx_RefNannyFinishContext();
13530 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
13531 PyObject *__pyx_v_have_slices = NULL;
13532 PyObject *__pyx_v_obj = NULL;
13534 __Pyx_TraceDeclarations
13535 __Pyx_RefNannyDeclarations
13537 PyObject *__pyx_t_2 = NULL;
13538 PyObject *__pyx_t_3 = NULL;
13539 PyObject *__pyx_t_4 = NULL;
13540 int __pyx_lineno = 0;
13541 const char *__pyx_filename = NULL;
13542 int __pyx_clineno = 0;
13543 __Pyx_RefNannySetupContext(
"__setitem__", 0);
13544 __Pyx_TraceCall(
"__setitem__", __pyx_f[1], 418, 0, __PYX_ERR(1, 418, __pyx_L1_error));
13545 __Pyx_INCREF(__pyx_v_index);
13554 __Pyx_TraceLine(419,0,__PYX_ERR(1, 419, __pyx_L1_error))
13555 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
13556 if (unlikely(__pyx_t_1)) {
13565 __Pyx_TraceLine(420,0,__PYX_ERR(1, 420, __pyx_L1_error))
13566 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
13567 __Pyx_GOTREF(__pyx_t_2);
13568 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13569 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13570 __PYX_ERR(1, 420, __pyx_L1_error)
13588 __Pyx_TraceLine(422,0,__PYX_ERR(1, 422, __pyx_L1_error))
13589 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 422, __pyx_L1_error)
13590 __Pyx_GOTREF(__pyx_t_2);
13591 if (likely(__pyx_t_2 != Py_None)) {
13592 PyObject* sequence = __pyx_t_2;
13593 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13594 if (unlikely(size != 2)) {
13595 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13596 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13597 __PYX_ERR(1, 422, __pyx_L1_error)
13599 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13600 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
13601 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
13602 __Pyx_INCREF(__pyx_t_3);
13603 __Pyx_INCREF(__pyx_t_4);
13605 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 422, __pyx_L1_error)
13606 __Pyx_GOTREF(__pyx_t_3);
13607 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 422, __pyx_L1_error)
13608 __Pyx_GOTREF(__pyx_t_4);
13610 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13612 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 422, __pyx_L1_error)
13614 __pyx_v_have_slices = __pyx_t_3;
13616 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
13626 __Pyx_TraceLine(424,0,__PYX_ERR(1, 424, __pyx_L1_error))
13627 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
13637 __Pyx_TraceLine(425,0,__PYX_ERR(1, 425, __pyx_L1_error))
13638 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
13639 __Pyx_GOTREF(__pyx_t_2);
13640 __pyx_v_obj = __pyx_t_2;
13650 __Pyx_TraceLine(426,0,__PYX_ERR(1, 426, __pyx_L1_error))
13651 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 426, __pyx_L1_error)
13661 __Pyx_TraceLine(427,0,__PYX_ERR(1, 427, __pyx_L1_error))
13662 __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
13663 __Pyx_GOTREF(__pyx_t_2);
13664 __pyx_t_4 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
13665 __Pyx_GOTREF(__pyx_t_4);
13666 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13667 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13686 __Pyx_TraceLine(429,0,__PYX_ERR(1, 429, __pyx_L1_error))
13688 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 429, __pyx_L1_error)
13689 __Pyx_GOTREF(__pyx_t_4);
13690 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 429, __pyx_L1_error)
13691 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((
struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 429, __pyx_L1_error)
13692 __Pyx_GOTREF(__pyx_t_2);
13693 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13694 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13715 __Pyx_TraceLine(431,0,__PYX_ERR(1, 431, __pyx_L1_error))
13717 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 431, __pyx_L1_error)
13718 __Pyx_GOTREF(__pyx_t_2);
13719 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13735 __Pyx_XDECREF(__pyx_t_2);
13736 __Pyx_XDECREF(__pyx_t_3);
13737 __Pyx_XDECREF(__pyx_t_4);
13738 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13741 __Pyx_XDECREF(__pyx_v_have_slices);
13742 __Pyx_XDECREF(__pyx_v_obj);
13743 __Pyx_XDECREF(__pyx_v_index);
13744 __Pyx_TraceReturn(Py_None, 0);
13745 __Pyx_RefNannyFinishContext();
13757 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
13758 PyObject *__pyx_r = NULL;
13759 __Pyx_TraceDeclarations
13760 __Pyx_RefNannyDeclarations
13763 PyObject *__pyx_t_3 = NULL;
13764 PyObject *__pyx_t_4 = NULL;
13765 PyObject *__pyx_t_5 = NULL;
13766 PyObject *__pyx_t_6 = NULL;
13767 PyObject *__pyx_t_7 = NULL;
13768 PyObject *__pyx_t_8 = NULL;
13770 int __pyx_lineno = 0;
13771 const char *__pyx_filename = NULL;
13772 int __pyx_clineno = 0;
13773 __Pyx_RefNannySetupContext(
"is_slice", 0);
13774 __Pyx_TraceCall(
"is_slice", __pyx_f[1], 433, 0, __PYX_ERR(1, 433, __pyx_L1_error));
13775 __Pyx_INCREF(__pyx_v_obj);
13784 __Pyx_TraceLine(434,0,__PYX_ERR(1, 434, __pyx_L1_error))
13785 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
13786 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13796 __Pyx_TraceLine(435,0,__PYX_ERR(1, 435, __pyx_L1_error))
13798 __Pyx_PyThreadState_declare
13799 __Pyx_PyThreadState_assign
13800 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
13801 __Pyx_XGOTREF(__pyx_t_3);
13802 __Pyx_XGOTREF(__pyx_t_4);
13803 __Pyx_XGOTREF(__pyx_t_5);
13813 __Pyx_TraceLine(436,0,__PYX_ERR(1, 436, __pyx_L4_error))
13814 __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 436, __pyx_L4_error)
13815 __Pyx_GOTREF(__pyx_t_6);
13824 __Pyx_TraceLine(437,0,__PYX_ERR(1, 437, __pyx_L4_error))
13825 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 437, __pyx_L4_error)
13826 __Pyx_GOTREF(__pyx_t_7);
13835 __Pyx_TraceLine(436,0,__PYX_ERR(1, 436, __pyx_L4_error))
13836 __pyx_t_8 = PyTuple_New(3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 436, __pyx_L4_error)
13837 __Pyx_GOTREF(__pyx_t_8);
13838 __Pyx_INCREF(__pyx_v_obj);
13839 __Pyx_GIVEREF(__pyx_v_obj);
13840 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
13841 __Pyx_GIVEREF(__pyx_t_6);
13842 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
13843 __Pyx_GIVEREF(__pyx_t_7);
13844 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
13847 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 436, __pyx_L4_error)
13848 __Pyx_GOTREF(__pyx_t_7);
13849 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13850 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
13861 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13862 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13863 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13864 goto __pyx_L9_try_end;
13866 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
13867 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13868 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
13877 __Pyx_TraceLine(438,0,__PYX_ERR(1, 438, __pyx_L6_except_error))
13878 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
13880 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13881 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 438, __pyx_L6_except_error)
13882 __Pyx_GOTREF(__pyx_t_7);
13883 __Pyx_GOTREF(__pyx_t_8);
13884 __Pyx_GOTREF(__pyx_t_6);
13893 __Pyx_TraceLine(439,0,__PYX_ERR(1, 439, __pyx_L6_except_error))
13894 __Pyx_XDECREF(__pyx_r);
13895 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13896 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13897 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13898 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13899 goto __pyx_L7_except_return;
13901 goto __pyx_L6_except_error;
13902 __pyx_L6_except_error:;
13911 __Pyx_XGIVEREF(__pyx_t_3);
13912 __Pyx_XGIVEREF(__pyx_t_4);
13913 __Pyx_XGIVEREF(__pyx_t_5);
13914 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
13915 goto __pyx_L1_error;
13916 __pyx_L7_except_return:;
13917 __Pyx_XGIVEREF(__pyx_t_3);
13918 __Pyx_XGIVEREF(__pyx_t_4);
13919 __Pyx_XGIVEREF(__pyx_t_5);
13920 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
13941 __Pyx_TraceLine(441,0,__PYX_ERR(1, 441, __pyx_L1_error))
13942 __Pyx_XDECREF(__pyx_r);
13943 __Pyx_INCREF(__pyx_v_obj);
13944 __pyx_r = __pyx_v_obj;
13957 __Pyx_XDECREF(__pyx_t_6);
13958 __Pyx_XDECREF(__pyx_t_7);
13959 __Pyx_XDECREF(__pyx_t_8);
13960 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13963 __Pyx_XDECREF(__pyx_v_obj);
13964 __Pyx_XGIVEREF(__pyx_r);
13965 __Pyx_TraceReturn(__pyx_r, 0);
13966 __Pyx_RefNannyFinishContext();
13978 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
13979 __Pyx_memviewslice __pyx_v_dst_slice;
13980 __Pyx_memviewslice __pyx_v_src_slice;
13981 PyObject *__pyx_r = NULL;
13982 __Pyx_TraceDeclarations
13983 __Pyx_RefNannyDeclarations
13984 __Pyx_memviewslice *__pyx_t_1;
13985 __Pyx_memviewslice *__pyx_t_2;
13986 PyObject *__pyx_t_3 = NULL;
13990 int __pyx_lineno = 0;
13991 const char *__pyx_filename = NULL;
13992 int __pyx_clineno = 0;
13993 __Pyx_RefNannySetupContext(
"setitem_slice_assignment", 0);
13994 __Pyx_TraceCall(
"setitem_slice_assignment", __pyx_f[1], 443, 0, __PYX_ERR(1, 443, __pyx_L1_error));
14003 __Pyx_TraceLine(447,0,__PYX_ERR(1, 447, __pyx_L1_error))
14004 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 447, __pyx_L1_error)
14005 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 447, __pyx_L1_error)
14014 __Pyx_TraceLine(448,0,__PYX_ERR(1, 448, __pyx_L1_error))
14015 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error)
14016 __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice));
if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error)
14025 __Pyx_TraceLine(449,0,__PYX_ERR(1, 449, __pyx_L1_error))
14026 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 449, __pyx_L1_error)
14027 __Pyx_GOTREF(__pyx_t_3);
14028 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 449, __pyx_L1_error)
14029 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14030 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 449, __pyx_L1_error)
14031 __Pyx_GOTREF(__pyx_t_3);
14032 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 449, __pyx_L1_error)
14033 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14042 __Pyx_TraceLine(447,0,__PYX_ERR(1, 447, __pyx_L1_error))
14043 __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 447, __pyx_L1_error)
14054 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14057 __Pyx_XDECREF(__pyx_t_3);
14058 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
14061 __Pyx_XGIVEREF(__pyx_r);
14062 __Pyx_TraceReturn(__pyx_r, 0);
14063 __Pyx_RefNannyFinishContext();
14075 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
14076 int __pyx_v_array[0x80];
14078 void *__pyx_v_item;
14079 __Pyx_memviewslice *__pyx_v_dst_slice;
14080 __Pyx_memviewslice __pyx_v_tmp_slice;
14081 PyObject *__pyx_r = NULL;
14082 __Pyx_TraceDeclarations
14083 __Pyx_RefNannyDeclarations
14084 __Pyx_memviewslice *__pyx_t_1;
14086 PyObject *__pyx_t_3 = NULL;
14089 char const *__pyx_t_6;
14090 PyObject *__pyx_t_7 = NULL;
14091 PyObject *__pyx_t_8 = NULL;
14092 PyObject *__pyx_t_9 = NULL;
14093 PyObject *__pyx_t_10 = NULL;
14094 PyObject *__pyx_t_11 = NULL;
14095 PyObject *__pyx_t_12 = NULL;
14096 int __pyx_lineno = 0;
14097 const char *__pyx_filename = NULL;
14098 int __pyx_clineno = 0;
14099 __Pyx_RefNannySetupContext(
"setitem_slice_assign_scalar", 0);
14100 __Pyx_TraceCall(
"setitem_slice_assign_scalar", __pyx_f[1], 451, 0, __PYX_ERR(1, 451, __pyx_L1_error));
14109 __Pyx_TraceLine(453,0,__PYX_ERR(1, 453, __pyx_L1_error))
14110 __pyx_v_tmp = NULL;
14119 __Pyx_TraceLine(458,0,__PYX_ERR(1, 458, __pyx_L1_error))
14120 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 458, __pyx_L1_error)
14121 __pyx_v_dst_slice = __pyx_t_1;
14130 __Pyx_TraceLine(460,0,__PYX_ERR(1, 460, __pyx_L1_error))
14131 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (
sizeof(__pyx_v_array))) != 0);
14141 __Pyx_TraceLine(461,0,__PYX_ERR(1, 461, __pyx_L1_error))
14142 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
14151 __Pyx_TraceLine(462,0,__PYX_ERR(1, 462, __pyx_L1_error))
14152 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
14153 if (unlikely(__pyx_t_2)) {
14162 __Pyx_TraceLine(463,0,__PYX_ERR(1, 463, __pyx_L1_error))
14163 PyErr_NoMemory(); __PYX_ERR(1, 463, __pyx_L1_error)
14181 __Pyx_TraceLine(464,0,__PYX_ERR(1, 464, __pyx_L1_error))
14182 __pyx_v_item = __pyx_v_tmp;
14201 __Pyx_TraceLine(466,0,__PYX_ERR(1, 466, __pyx_L1_error))
14203 __pyx_v_item = ((
void *)__pyx_v_array);
14214 __Pyx_TraceLine(468,0,__PYX_ERR(1, 468, __pyx_L1_error))
14224 __Pyx_TraceLine(469,0,__PYX_ERR(1, 469, __pyx_L6_error))
14225 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
14235 __Pyx_TraceLine(470,0,__PYX_ERR(1, 470, __pyx_L6_error))
14236 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
14255 __Pyx_TraceLine(472,0,__PYX_ERR(1, 472, __pyx_L6_error))
14257 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((
char *)__pyx_v_item), __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 472, __pyx_L6_error)
14258 __Pyx_GOTREF(__pyx_t_3);
14259 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14270 __Pyx_TraceLine(476,0,__PYX_ERR(1, 476, __pyx_L6_error))
14271 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
14281 __Pyx_TraceLine(477,0,__PYX_ERR(1, 477, __pyx_L6_error))
14282 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 477, __pyx_L6_error)
14283 __Pyx_GOTREF(__pyx_t_3);
14284 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14302 __Pyx_TraceLine(478,0,__PYX_ERR(1, 478, __pyx_L6_error))
14303 __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
14313 __Pyx_TraceLine(481,0,__PYX_ERR(1, 481, __pyx_L6_error))
14316 PyMem_Free(__pyx_v_tmp);
14321 __Pyx_PyThreadState_declare
14322 __Pyx_PyThreadState_assign
14323 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
14324 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14325 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
14326 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
14327 __Pyx_XGOTREF(__pyx_t_7);
14328 __Pyx_XGOTREF(__pyx_t_8);
14329 __Pyx_XGOTREF(__pyx_t_9);
14330 __Pyx_XGOTREF(__pyx_t_10);
14331 __Pyx_XGOTREF(__pyx_t_11);
14332 __Pyx_XGOTREF(__pyx_t_12);
14333 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
14335 PyMem_Free(__pyx_v_tmp);
14337 if (PY_MAJOR_VERSION >= 3) {
14338 __Pyx_XGIVEREF(__pyx_t_10);
14339 __Pyx_XGIVEREF(__pyx_t_11);
14340 __Pyx_XGIVEREF(__pyx_t_12);
14341 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
14343 __Pyx_XGIVEREF(__pyx_t_7);
14344 __Pyx_XGIVEREF(__pyx_t_8);
14345 __Pyx_XGIVEREF(__pyx_t_9);
14346 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
14347 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
14348 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
14349 goto __pyx_L1_error;
14363 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14366 __Pyx_XDECREF(__pyx_t_3);
14367 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
14370 __Pyx_XGIVEREF(__pyx_r);
14371 __Pyx_TraceReturn(__pyx_r, 0);
14372 __Pyx_RefNannyFinishContext();
14384 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
14385 char *__pyx_v_itemp;
14386 PyObject *__pyx_r = NULL;
14387 __Pyx_TraceDeclarations
14388 __Pyx_RefNannyDeclarations
14390 PyObject *__pyx_t_2 = NULL;
14391 int __pyx_lineno = 0;
14392 const char *__pyx_filename = NULL;
14393 int __pyx_clineno = 0;
14394 __Pyx_RefNannySetupContext(
"setitem_indexed", 0);
14395 __Pyx_TraceCall(
"setitem_indexed", __pyx_f[1], 483, 0, __PYX_ERR(1, 483, __pyx_L1_error));
14404 __Pyx_TraceLine(484,0,__PYX_ERR(1, 484, __pyx_L1_error))
14405 __pyx_t_1 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index);
if (unlikely(__pyx_t_1 == ((
char *)NULL))) __PYX_ERR(1, 484, __pyx_L1_error)
14406 __pyx_v_itemp = __pyx_t_1;
14415 __Pyx_TraceLine(485,0,__PYX_ERR(1, 485, __pyx_L1_error))
14416 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 485, __pyx_L1_error)
14417 __Pyx_GOTREF(__pyx_t_2);
14418 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14429 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14432 __Pyx_XDECREF(__pyx_t_2);
14433 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
14436 __Pyx_XGIVEREF(__pyx_r);
14437 __Pyx_TraceReturn(__pyx_r, 0);
14438 __Pyx_RefNannyFinishContext();
14450 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp) {
14451 PyObject *__pyx_v_struct = NULL;
14452 PyObject *__pyx_v_bytesitem = 0;
14453 PyObject *__pyx_v_result = NULL;
14454 PyObject *__pyx_r = NULL;
14455 __Pyx_TraceDeclarations
14456 __Pyx_RefNannyDeclarations
14457 PyObject *__pyx_t_1 = NULL;
14458 PyObject *__pyx_t_2 = NULL;
14459 PyObject *__pyx_t_3 = NULL;
14460 PyObject *__pyx_t_4 = NULL;
14461 PyObject *__pyx_t_5 = NULL;
14462 PyObject *__pyx_t_6 = NULL;
14463 PyObject *__pyx_t_7 = NULL;
14465 PyObject *__pyx_t_9 = NULL;
14468 int __pyx_lineno = 0;
14469 const char *__pyx_filename = NULL;
14470 int __pyx_clineno = 0;
14471 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
14472 __Pyx_TraceCall(
"convert_item_to_object", __pyx_f[1], 487, 0, __PYX_ERR(1, 487, __pyx_L1_error));
14481 __Pyx_TraceLine(490,0,__PYX_ERR(1, 490, __pyx_L1_error))
14482 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 490, __pyx_L1_error)
14483 __Pyx_GOTREF(__pyx_t_1);
14484 __pyx_v_struct = __pyx_t_1;
14494 __Pyx_TraceLine(493,0,__PYX_ERR(1, 493, __pyx_L1_error))
14495 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L1_error)
14496 __Pyx_GOTREF(__pyx_t_1);
14497 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
14507 __Pyx_TraceLine(494,0,__PYX_ERR(1, 494, __pyx_L1_error))
14509 __Pyx_PyThreadState_declare
14510 __Pyx_PyThreadState_assign
14511 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
14512 __Pyx_XGOTREF(__pyx_t_2);
14513 __Pyx_XGOTREF(__pyx_t_3);
14514 __Pyx_XGOTREF(__pyx_t_4);
14524 __Pyx_TraceLine(495,0,__PYX_ERR(1, 495, __pyx_L3_error))
14525 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 495, __pyx_L3_error)
14526 __Pyx_GOTREF(__pyx_t_5);
14527 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L3_error)
14528 __Pyx_GOTREF(__pyx_t_6);
14531 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
14532 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
14533 if (likely(__pyx_t_7)) {
14534 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
14535 __Pyx_INCREF(__pyx_t_7);
14536 __Pyx_INCREF(
function);
14537 __Pyx_DECREF_SET(__pyx_t_5,
function);
14541 #if CYTHON_FAST_PYCALL
14542 if (PyFunction_Check(__pyx_t_5)) {
14543 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
14544 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L3_error)
14545 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
14546 __Pyx_GOTREF(__pyx_t_1);
14547 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14550 #if CYTHON_FAST_PYCCALL
14551 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
14552 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
14553 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L3_error)
14554 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
14555 __Pyx_GOTREF(__pyx_t_1);
14556 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14560 __pyx_t_9 = PyTuple_New(2+__pyx_t_8);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 495, __pyx_L3_error)
14561 __Pyx_GOTREF(__pyx_t_9);
14563 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
14565 __Pyx_GIVEREF(__pyx_t_6);
14566 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
14567 __Pyx_INCREF(__pyx_v_bytesitem);
14568 __Pyx_GIVEREF(__pyx_v_bytesitem);
14569 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
14571 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L3_error)
14572 __Pyx_GOTREF(__pyx_t_1);
14573 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14575 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14576 __pyx_v_result = __pyx_t_1;
14595 __Pyx_TraceLine(499,0,__PYX_ERR(1, 499, __pyx_L5_except_error))
14597 __pyx_t_10 = strlen(__pyx_v_self->view.format);
14598 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
14608 __Pyx_TraceLine(500,0,__PYX_ERR(1, 500, __pyx_L5_except_error))
14609 __Pyx_XDECREF(__pyx_r);
14610 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 500, __pyx_L5_except_error)
14611 __Pyx_GOTREF(__pyx_t_1);
14612 __pyx_r = __pyx_t_1;
14614 goto __pyx_L6_except_return;
14632 __Pyx_TraceLine(501,0,__PYX_ERR(1, 501, __pyx_L5_except_error))
14633 __Pyx_XDECREF(__pyx_r);
14634 __Pyx_INCREF(__pyx_v_result);
14635 __pyx_r = __pyx_v_result;
14636 goto __pyx_L6_except_return;
14639 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
14640 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14641 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
14642 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
14643 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
14652 __Pyx_TraceLine(496,0,__PYX_ERR(1, 496, __pyx_L5_except_error))
14653 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
14654 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 496, __pyx_L5_except_error)
14655 __Pyx_GOTREF(__pyx_t_6);
14656 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
14657 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14658 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
14659 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
14661 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14662 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 496, __pyx_L5_except_error)
14663 __Pyx_GOTREF(__pyx_t_9);
14664 __Pyx_GOTREF(__pyx_t_5);
14665 __Pyx_GOTREF(__pyx_t_1);
14674 __Pyx_TraceLine(497,0,__PYX_ERR(1, 497, __pyx_L5_except_error))
14675 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L5_except_error)
14676 __Pyx_GOTREF(__pyx_t_6);
14677 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
14678 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14679 __PYX_ERR(1, 497, __pyx_L5_except_error)
14681 goto __pyx_L5_except_error;
14682 __pyx_L5_except_error:;
14691 __Pyx_XGIVEREF(__pyx_t_2);
14692 __Pyx_XGIVEREF(__pyx_t_3);
14693 __Pyx_XGIVEREF(__pyx_t_4);
14694 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
14695 goto __pyx_L1_error;
14696 __pyx_L6_except_return:;
14697 __Pyx_XGIVEREF(__pyx_t_2);
14698 __Pyx_XGIVEREF(__pyx_t_3);
14699 __Pyx_XGIVEREF(__pyx_t_4);
14700 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
14714 __Pyx_XDECREF(__pyx_t_1);
14715 __Pyx_XDECREF(__pyx_t_5);
14716 __Pyx_XDECREF(__pyx_t_6);
14717 __Pyx_XDECREF(__pyx_t_7);
14718 __Pyx_XDECREF(__pyx_t_9);
14719 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14722 __Pyx_XDECREF(__pyx_v_struct);
14723 __Pyx_XDECREF(__pyx_v_bytesitem);
14724 __Pyx_XDECREF(__pyx_v_result);
14725 __Pyx_XGIVEREF(__pyx_r);
14726 __Pyx_TraceReturn(__pyx_r, 0);
14727 __Pyx_RefNannyFinishContext();
14739 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
14740 PyObject *__pyx_v_struct = NULL;
14742 PyObject *__pyx_v_bytesvalue = 0;
14743 Py_ssize_t __pyx_v_i;
14744 PyObject *__pyx_r = NULL;
14745 __Pyx_TraceDeclarations
14746 __Pyx_RefNannyDeclarations
14747 PyObject *__pyx_t_1 = NULL;
14750 PyObject *__pyx_t_4 = NULL;
14751 PyObject *__pyx_t_5 = NULL;
14752 PyObject *__pyx_t_6 = NULL;
14754 PyObject *__pyx_t_8 = NULL;
14755 Py_ssize_t __pyx_t_9;
14756 PyObject *__pyx_t_10 = NULL;
14761 int __pyx_lineno = 0;
14762 const char *__pyx_filename = NULL;
14763 int __pyx_clineno = 0;
14764 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
14765 __Pyx_TraceCall(
"assign_item_from_object", __pyx_f[1], 503, 0, __PYX_ERR(1, 503, __pyx_L1_error));
14774 __Pyx_TraceLine(506,0,__PYX_ERR(1, 506, __pyx_L1_error))
14775 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 506, __pyx_L1_error)
14776 __Pyx_GOTREF(__pyx_t_1);
14777 __pyx_v_struct = __pyx_t_1;
14787 __Pyx_TraceLine(511,0,__PYX_ERR(1, 511, __pyx_L1_error))
14788 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
14789 __pyx_t_3 = (__pyx_t_2 != 0);
14799 __Pyx_TraceLine(512,0,__PYX_ERR(1, 512, __pyx_L1_error))
14800 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
14801 __Pyx_GOTREF(__pyx_t_1);
14802 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
14803 __Pyx_GOTREF(__pyx_t_4);
14804 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 512, __pyx_L1_error)
14805 __Pyx_GOTREF(__pyx_t_5);
14806 __Pyx_GIVEREF(__pyx_t_4);
14807 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
14809 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
14810 __Pyx_GOTREF(__pyx_t_4);
14811 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
14812 __Pyx_GOTREF(__pyx_t_6);
14813 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14814 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14815 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
14816 __Pyx_GOTREF(__pyx_t_4);
14817 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14818 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14819 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 512, __pyx_L1_error)
14820 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
14840 __Pyx_TraceLine(514,0,__PYX_ERR(1, 514, __pyx_L1_error))
14842 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 514, __pyx_L1_error)
14843 __Pyx_GOTREF(__pyx_t_6);
14844 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error)
14845 __Pyx_GOTREF(__pyx_t_1);
14848 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
14849 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
14850 if (likely(__pyx_t_5)) {
14851 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
14852 __Pyx_INCREF(__pyx_t_5);
14853 __Pyx_INCREF(
function);
14854 __Pyx_DECREF_SET(__pyx_t_6,
function);
14858 #if CYTHON_FAST_PYCALL
14859 if (PyFunction_Check(__pyx_t_6)) {
14860 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
14861 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error)
14862 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14863 __Pyx_GOTREF(__pyx_t_4);
14864 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14867 #if CYTHON_FAST_PYCCALL
14868 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
14869 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
14870 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error)
14871 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14872 __Pyx_GOTREF(__pyx_t_4);
14873 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14877 __pyx_t_8 = PyTuple_New(2+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 514, __pyx_L1_error)
14878 __Pyx_GOTREF(__pyx_t_8);
14880 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
14882 __Pyx_GIVEREF(__pyx_t_1);
14883 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
14884 __Pyx_INCREF(__pyx_v_value);
14885 __Pyx_GIVEREF(__pyx_v_value);
14886 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
14888 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error)
14889 __Pyx_GOTREF(__pyx_t_4);
14890 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14892 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14893 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 514, __pyx_L1_error)
14894 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
14906 __Pyx_TraceLine(516,0,__PYX_ERR(1, 516, __pyx_L1_error))
14908 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
14909 PyErr_SetString(PyExc_TypeError,
"'NoneType' is not iterable");
14910 __PYX_ERR(1, 516, __pyx_L1_error)
14912 __Pyx_INCREF(__pyx_v_bytesvalue);
14913 __pyx_t_10 = __pyx_v_bytesvalue;
14914 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
14915 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
14916 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
14917 __pyx_t_11 = __pyx_t_14;
14918 __pyx_v_c = (__pyx_t_11[0]);
14927 __Pyx_TraceLine(517,0,__PYX_ERR(1, 517, __pyx_L1_error))
14928 __pyx_v_i = __pyx_t_9;
14937 __Pyx_TraceLine(516,0,__PYX_ERR(1, 516, __pyx_L1_error))
14938 __pyx_t_9 = (__pyx_t_9 + 1);
14947 __Pyx_TraceLine(517,0,__PYX_ERR(1, 517, __pyx_L1_error))
14948 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
14950 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14961 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14964 __Pyx_XDECREF(__pyx_t_1);
14965 __Pyx_XDECREF(__pyx_t_4);
14966 __Pyx_XDECREF(__pyx_t_5);
14967 __Pyx_XDECREF(__pyx_t_6);
14968 __Pyx_XDECREF(__pyx_t_8);
14969 __Pyx_XDECREF(__pyx_t_10);
14970 __Pyx_AddTraceback(
"View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14973 __Pyx_XDECREF(__pyx_v_struct);
14974 __Pyx_XDECREF(__pyx_v_bytesvalue);
14975 __Pyx_XGIVEREF(__pyx_r);
14976 __Pyx_TraceReturn(__pyx_r, 0);
14977 __Pyx_RefNannyFinishContext();
14990 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
14991 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
14993 __Pyx_RefNannyDeclarations
14994 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
14995 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
14998 __Pyx_RefNannyFinishContext();
15002 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
15004 __Pyx_TraceDeclarations
15005 __Pyx_RefNannyDeclarations
15008 PyObject *__pyx_t_3 = NULL;
15009 Py_ssize_t *__pyx_t_4;
15013 Py_ssize_t __pyx_t_8;
15014 int __pyx_lineno = 0;
15015 const char *__pyx_filename = NULL;
15016 int __pyx_clineno = 0;
15017 if (__pyx_v_info == NULL) {
15018 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
15021 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
15022 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
15023 __Pyx_GIVEREF(__pyx_v_info->obj);
15024 __Pyx_TraceCall(
"__getbuffer__", __pyx_f[1], 520, 0, __PYX_ERR(1, 520, __pyx_L1_error));
15033 __Pyx_TraceLine(521,0,__PYX_ERR(1, 521, __pyx_L1_error))
15034 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
15037 __pyx_t_1 = __pyx_t_2;
15038 goto __pyx_L4_bool_binop_done;
15040 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
15041 __pyx_t_1 = __pyx_t_2;
15042 __pyx_L4_bool_binop_done:;
15043 if (unlikely(__pyx_t_1)) {
15052 __Pyx_TraceLine(522,0,__PYX_ERR(1, 522, __pyx_L1_error))
15053 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 522, __pyx_L1_error)
15054 __Pyx_GOTREF(__pyx_t_3);
15055 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15056 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15057 __PYX_ERR(1, 522, __pyx_L1_error)
15075 __Pyx_TraceLine(524,0,__PYX_ERR(1, 524, __pyx_L1_error))
15076 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
15086 __Pyx_TraceLine(525,0,__PYX_ERR(1, 525, __pyx_L1_error))
15087 __pyx_t_4 = __pyx_v_self->view.shape;
15088 __pyx_v_info->shape = __pyx_t_4;
15107 __Pyx_TraceLine(527,0,__PYX_ERR(1, 527, __pyx_L1_error))
15109 __pyx_v_info->shape = NULL;
15120 __Pyx_TraceLine(529,0,__PYX_ERR(1, 529, __pyx_L1_error))
15121 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
15131 __Pyx_TraceLine(530,0,__PYX_ERR(1, 530, __pyx_L1_error))
15132 __pyx_t_4 = __pyx_v_self->view.strides;
15133 __pyx_v_info->strides = __pyx_t_4;
15152 __Pyx_TraceLine(532,0,__PYX_ERR(1, 532, __pyx_L1_error))
15154 __pyx_v_info->strides = NULL;
15165 __Pyx_TraceLine(534,0,__PYX_ERR(1, 534, __pyx_L1_error))
15166 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
15176 __Pyx_TraceLine(535,0,__PYX_ERR(1, 535, __pyx_L1_error))
15177 __pyx_t_4 = __pyx_v_self->view.suboffsets;
15178 __pyx_v_info->suboffsets = __pyx_t_4;
15197 __Pyx_TraceLine(537,0,__PYX_ERR(1, 537, __pyx_L1_error))
15199 __pyx_v_info->suboffsets = NULL;
15210 __Pyx_TraceLine(539,0,__PYX_ERR(1, 539, __pyx_L1_error))
15211 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
15221 __Pyx_TraceLine(540,0,__PYX_ERR(1, 540, __pyx_L1_error))
15222 __pyx_t_5 = __pyx_v_self->view.format;
15223 __pyx_v_info->format = __pyx_t_5;
15242 __Pyx_TraceLine(542,0,__PYX_ERR(1, 542, __pyx_L1_error))
15244 __pyx_v_info->format = NULL;
15255 __Pyx_TraceLine(544,0,__PYX_ERR(1, 544, __pyx_L1_error))
15256 __pyx_t_6 = __pyx_v_self->view.buf;
15257 __pyx_v_info->buf = __pyx_t_6;
15266 __Pyx_TraceLine(545,0,__PYX_ERR(1, 545, __pyx_L1_error))
15267 __pyx_t_7 = __pyx_v_self->view.ndim;
15268 __pyx_v_info->ndim = __pyx_t_7;
15277 __Pyx_TraceLine(546,0,__PYX_ERR(1, 546, __pyx_L1_error))
15278 __pyx_t_8 = __pyx_v_self->view.itemsize;
15279 __pyx_v_info->itemsize = __pyx_t_8;
15288 __Pyx_TraceLine(547,0,__PYX_ERR(1, 547, __pyx_L1_error))
15289 __pyx_t_8 = __pyx_v_self->view.len;
15290 __pyx_v_info->len = __pyx_t_8;
15299 __Pyx_TraceLine(548,0,__PYX_ERR(1, 548, __pyx_L1_error))
15300 __pyx_t_1 = __pyx_v_self->view.readonly;
15301 __pyx_v_info->readonly = __pyx_t_1;
15310 __Pyx_TraceLine(549,0,__PYX_ERR(1, 549, __pyx_L1_error))
15311 __Pyx_INCREF(((PyObject *)__pyx_v_self));
15312 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
15313 __Pyx_GOTREF(__pyx_v_info->obj);
15314 __Pyx_DECREF(__pyx_v_info->obj);
15315 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
15329 __Pyx_XDECREF(__pyx_t_3);
15330 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15332 if (__pyx_v_info->obj != NULL) {
15333 __Pyx_GOTREF(__pyx_v_info->obj);
15334 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
15338 if (__pyx_v_info->obj == Py_None) {
15339 __Pyx_GOTREF(__pyx_v_info->obj);
15340 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
15343 __Pyx_TraceReturn(Py_None, 0);
15344 __Pyx_RefNannyFinishContext();
15357 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self);
15358 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
15359 PyObject *__pyx_r = 0;
15360 __Pyx_RefNannyDeclarations
15361 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
15362 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
15365 __Pyx_RefNannyFinishContext();
15369 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
15370 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
15371 PyObject *__pyx_r = NULL;
15372 __Pyx_TraceDeclarations
15373 __Pyx_RefNannyDeclarations
15374 PyObject *__pyx_t_1 = NULL;
15376 int __pyx_lineno = 0;
15377 const char *__pyx_filename = NULL;
15378 int __pyx_clineno = 0;
15379 __Pyx_RefNannySetupContext(
"__get__", 0);
15380 __Pyx_TraceCall(
"__get__", __pyx_f[1], 555, 0, __PYX_ERR(1, 555, __pyx_L1_error));
15389 __Pyx_TraceLine(556,0,__PYX_ERR(1, 556, __pyx_L1_error))
15390 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error)
15391 __Pyx_GOTREF(__pyx_t_1);
15392 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error)
15393 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_1);
15403 __Pyx_TraceLine(557,0,__PYX_ERR(1, 557, __pyx_L1_error))
15404 __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice));
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 557, __pyx_L1_error)
15413 __Pyx_TraceLine(558,0,__PYX_ERR(1, 558, __pyx_L1_error))
15414 __Pyx_XDECREF(__pyx_r);
15415 __Pyx_INCREF(((PyObject *)__pyx_v_result));
15416 __pyx_r = ((PyObject *)__pyx_v_result);
15429 __Pyx_XDECREF(__pyx_t_1);
15430 __Pyx_AddTraceback(
"View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15433 __Pyx_XDECREF((PyObject *)__pyx_v_result);
15434 __Pyx_XGIVEREF(__pyx_r);
15435 __Pyx_TraceReturn(__pyx_r, 0);
15436 __Pyx_RefNannyFinishContext();
15449 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self);
15450 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
15451 PyObject *__pyx_r = 0;
15452 __Pyx_RefNannyDeclarations
15453 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
15454 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
15457 __Pyx_RefNannyFinishContext();
15461 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
15462 PyObject *__pyx_r = NULL;
15463 __Pyx_TraceDeclarations
15464 __Pyx_RefNannyDeclarations
15465 int __pyx_lineno = 0;
15466 const char *__pyx_filename = NULL;
15467 int __pyx_clineno = 0;
15468 __Pyx_RefNannySetupContext(
"__get__", 0);
15469 __Pyx_TraceCall(
"__get__", __pyx_f[1], 561, 0, __PYX_ERR(1, 561, __pyx_L1_error));
15478 __Pyx_TraceLine(562,0,__PYX_ERR(1, 562, __pyx_L1_error))
15479 __Pyx_XDECREF(__pyx_r);
15480 __Pyx_INCREF(__pyx_v_self->obj);
15481 __pyx_r = __pyx_v_self->obj;
15494 __Pyx_AddTraceback(
"View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15497 __Pyx_XGIVEREF(__pyx_r);
15498 __Pyx_TraceReturn(__pyx_r, 0);
15499 __Pyx_RefNannyFinishContext();
15512 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self);
15513 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
15514 PyObject *__pyx_r = 0;
15515 __Pyx_RefNannyDeclarations
15516 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
15517 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
15520 __Pyx_RefNannyFinishContext();
15524 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
15525 Py_ssize_t __pyx_v_length;
15526 PyObject *__pyx_r = NULL;
15527 __Pyx_TraceDeclarations
15528 __Pyx_RefNannyDeclarations
15529 PyObject *__pyx_t_1 = NULL;
15530 Py_ssize_t *__pyx_t_2;
15531 Py_ssize_t *__pyx_t_3;
15532 Py_ssize_t *__pyx_t_4;
15533 PyObject *__pyx_t_5 = NULL;
15534 int __pyx_lineno = 0;
15535 const char *__pyx_filename = NULL;
15536 int __pyx_clineno = 0;
15537 __Pyx_RefNannySetupContext(
"__get__", 0);
15538 __Pyx_TraceCall(
"__get__", __pyx_f[1], 565, 0, __PYX_ERR(1, 565, __pyx_L1_error));
15547 __Pyx_TraceLine(566,0,__PYX_ERR(1, 566, __pyx_L1_error))
15548 __Pyx_XDECREF(__pyx_r);
15549 __pyx_t_1 = PyList_New(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 566, __pyx_L1_error)
15550 __Pyx_GOTREF(__pyx_t_1);
15551 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
15552 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
15553 __pyx_t_2 = __pyx_t_4;
15554 __pyx_v_length = (__pyx_t_2[0]);
15555 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 566, __pyx_L1_error)
15556 __Pyx_GOTREF(__pyx_t_5);
15557 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 566, __pyx_L1_error)
15558 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15560 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1));
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 566, __pyx_L1_error)
15561 __Pyx_GOTREF(__pyx_t_5);
15562 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15563 __pyx_r = __pyx_t_5;
15577 __Pyx_XDECREF(__pyx_t_1);
15578 __Pyx_XDECREF(__pyx_t_5);
15579 __Pyx_AddTraceback(
"View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15582 __Pyx_XGIVEREF(__pyx_r);
15583 __Pyx_TraceReturn(__pyx_r, 0);
15584 __Pyx_RefNannyFinishContext();
15597 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self);
15598 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
15599 PyObject *__pyx_r = 0;
15600 __Pyx_RefNannyDeclarations
15601 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
15602 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
15605 __Pyx_RefNannyFinishContext();
15609 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
15610 Py_ssize_t __pyx_v_stride;
15611 PyObject *__pyx_r = NULL;
15612 __Pyx_TraceDeclarations
15613 __Pyx_RefNannyDeclarations
15615 PyObject *__pyx_t_2 = NULL;
15616 Py_ssize_t *__pyx_t_3;
15617 Py_ssize_t *__pyx_t_4;
15618 Py_ssize_t *__pyx_t_5;
15619 PyObject *__pyx_t_6 = NULL;
15620 int __pyx_lineno = 0;
15621 const char *__pyx_filename = NULL;
15622 int __pyx_clineno = 0;
15623 __Pyx_RefNannySetupContext(
"__get__", 0);
15624 __Pyx_TraceCall(
"__get__", __pyx_f[1], 569, 0, __PYX_ERR(1, 569, __pyx_L1_error));
15633 __Pyx_TraceLine(570,0,__PYX_ERR(1, 570, __pyx_L1_error))
15634 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
15635 if (unlikely(__pyx_t_1)) {
15644 __Pyx_TraceLine(572,0,__PYX_ERR(1, 572, __pyx_L1_error))
15645 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
15646 __Pyx_GOTREF(__pyx_t_2);
15647 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
15648 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15649 __PYX_ERR(1, 572, __pyx_L1_error)
15667 __Pyx_TraceLine(574,0,__PYX_ERR(1, 574, __pyx_L1_error))
15668 __Pyx_XDECREF(__pyx_r);
15669 __pyx_t_2 = PyList_New(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 574, __pyx_L1_error)
15670 __Pyx_GOTREF(__pyx_t_2);
15671 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
15672 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
15673 __pyx_t_3 = __pyx_t_5;
15674 __pyx_v_stride = (__pyx_t_3[0]);
15675 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 574, __pyx_L1_error)
15676 __Pyx_GOTREF(__pyx_t_6);
15677 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 574, __pyx_L1_error)
15678 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15680 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 574, __pyx_L1_error)
15681 __Pyx_GOTREF(__pyx_t_6);
15682 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15683 __pyx_r = __pyx_t_6;
15697 __Pyx_XDECREF(__pyx_t_2);
15698 __Pyx_XDECREF(__pyx_t_6);
15699 __Pyx_AddTraceback(
"View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15702 __Pyx_XGIVEREF(__pyx_r);
15703 __Pyx_TraceReturn(__pyx_r, 0);
15704 __Pyx_RefNannyFinishContext();
15717 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self);
15718 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
15719 PyObject *__pyx_r = 0;
15720 __Pyx_RefNannyDeclarations
15721 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
15722 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
15725 __Pyx_RefNannyFinishContext();
15729 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
15730 Py_ssize_t __pyx_v_suboffset;
15731 PyObject *__pyx_r = NULL;
15732 __Pyx_TraceDeclarations
15733 __Pyx_RefNannyDeclarations
15735 PyObject *__pyx_t_2 = NULL;
15736 PyObject *__pyx_t_3 = NULL;
15737 Py_ssize_t *__pyx_t_4;
15738 Py_ssize_t *__pyx_t_5;
15739 Py_ssize_t *__pyx_t_6;
15740 int __pyx_lineno = 0;
15741 const char *__pyx_filename = NULL;
15742 int __pyx_clineno = 0;
15743 __Pyx_RefNannySetupContext(
"__get__", 0);
15744 __Pyx_TraceCall(
"__get__", __pyx_f[1], 577, 0, __PYX_ERR(1, 577, __pyx_L1_error));
15753 __Pyx_TraceLine(578,0,__PYX_ERR(1, 578, __pyx_L1_error))
15754 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
15764 __Pyx_TraceLine(579,0,__PYX_ERR(1, 579, __pyx_L1_error))
15765 __Pyx_XDECREF(__pyx_r);
15766 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
15767 __Pyx_GOTREF(__pyx_t_2);
15768 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__19, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
15769 __Pyx_GOTREF(__pyx_t_3);
15770 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15771 __pyx_r = __pyx_t_3;
15791 __Pyx_TraceLine(581,0,__PYX_ERR(1, 581, __pyx_L1_error))
15792 __Pyx_XDECREF(__pyx_r);
15793 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 581, __pyx_L1_error)
15794 __Pyx_GOTREF(__pyx_t_3);
15795 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
15796 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
15797 __pyx_t_4 = __pyx_t_6;
15798 __pyx_v_suboffset = (__pyx_t_4[0]);
15799 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 581, __pyx_L1_error)
15800 __Pyx_GOTREF(__pyx_t_2);
15801 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 581, __pyx_L1_error)
15802 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15804 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 581, __pyx_L1_error)
15805 __Pyx_GOTREF(__pyx_t_2);
15806 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15807 __pyx_r = __pyx_t_2;
15821 __Pyx_XDECREF(__pyx_t_2);
15822 __Pyx_XDECREF(__pyx_t_3);
15823 __Pyx_AddTraceback(
"View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15826 __Pyx_XGIVEREF(__pyx_r);
15827 __Pyx_TraceReturn(__pyx_r, 0);
15828 __Pyx_RefNannyFinishContext();
15841 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self);
15842 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
15843 PyObject *__pyx_r = 0;
15844 __Pyx_RefNannyDeclarations
15845 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
15846 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
15849 __Pyx_RefNannyFinishContext();
15853 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
15854 PyObject *__pyx_r = NULL;
15855 __Pyx_TraceDeclarations
15856 __Pyx_RefNannyDeclarations
15857 PyObject *__pyx_t_1 = NULL;
15858 int __pyx_lineno = 0;
15859 const char *__pyx_filename = NULL;
15860 int __pyx_clineno = 0;
15861 __Pyx_RefNannySetupContext(
"__get__", 0);
15862 __Pyx_TraceCall(
"__get__", __pyx_f[1], 584, 0, __PYX_ERR(1, 584, __pyx_L1_error));
15871 __Pyx_TraceLine(585,0,__PYX_ERR(1, 585, __pyx_L1_error))
15872 __Pyx_XDECREF(__pyx_r);
15873 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 585, __pyx_L1_error)
15874 __Pyx_GOTREF(__pyx_t_1);
15875 __pyx_r = __pyx_t_1;
15889 __Pyx_XDECREF(__pyx_t_1);
15890 __Pyx_AddTraceback(
"View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15893 __Pyx_XGIVEREF(__pyx_r);
15894 __Pyx_TraceReturn(__pyx_r, 0);
15895 __Pyx_RefNannyFinishContext();
15908 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self);
15909 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
15910 PyObject *__pyx_r = 0;
15911 __Pyx_RefNannyDeclarations
15912 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
15913 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
15916 __Pyx_RefNannyFinishContext();
15920 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
15921 PyObject *__pyx_r = NULL;
15922 __Pyx_TraceDeclarations
15923 __Pyx_RefNannyDeclarations
15924 PyObject *__pyx_t_1 = NULL;
15925 int __pyx_lineno = 0;
15926 const char *__pyx_filename = NULL;
15927 int __pyx_clineno = 0;
15928 __Pyx_RefNannySetupContext(
"__get__", 0);
15929 __Pyx_TraceCall(
"__get__", __pyx_f[1], 588, 0, __PYX_ERR(1, 588, __pyx_L1_error));
15938 __Pyx_TraceLine(589,0,__PYX_ERR(1, 589, __pyx_L1_error))
15939 __Pyx_XDECREF(__pyx_r);
15940 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error)
15941 __Pyx_GOTREF(__pyx_t_1);
15942 __pyx_r = __pyx_t_1;
15956 __Pyx_XDECREF(__pyx_t_1);
15957 __Pyx_AddTraceback(
"View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15960 __Pyx_XGIVEREF(__pyx_r);
15961 __Pyx_TraceReturn(__pyx_r, 0);
15962 __Pyx_RefNannyFinishContext();
15975 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self);
15976 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
15977 PyObject *__pyx_r = 0;
15978 __Pyx_RefNannyDeclarations
15979 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
15980 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
15983 __Pyx_RefNannyFinishContext();
15987 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
15988 PyObject *__pyx_r = NULL;
15989 __Pyx_TraceDeclarations
15990 __Pyx_RefNannyDeclarations
15991 PyObject *__pyx_t_1 = NULL;
15992 PyObject *__pyx_t_2 = NULL;
15993 PyObject *__pyx_t_3 = NULL;
15994 int __pyx_lineno = 0;
15995 const char *__pyx_filename = NULL;
15996 int __pyx_clineno = 0;
15997 __Pyx_RefNannySetupContext(
"__get__", 0);
15998 __Pyx_TraceCall(
"__get__", __pyx_f[1], 592, 0, __PYX_ERR(1, 592, __pyx_L1_error));
16007 __Pyx_TraceLine(593,0,__PYX_ERR(1, 593, __pyx_L1_error))
16008 __Pyx_XDECREF(__pyx_r);
16009 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error)
16010 __Pyx_GOTREF(__pyx_t_1);
16011 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 593, __pyx_L1_error)
16012 __Pyx_GOTREF(__pyx_t_2);
16013 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 593, __pyx_L1_error)
16014 __Pyx_GOTREF(__pyx_t_3);
16015 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16016 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16017 __pyx_r = __pyx_t_3;
16031 __Pyx_XDECREF(__pyx_t_1);
16032 __Pyx_XDECREF(__pyx_t_2);
16033 __Pyx_XDECREF(__pyx_t_3);
16034 __Pyx_AddTraceback(
"View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16037 __Pyx_XGIVEREF(__pyx_r);
16038 __Pyx_TraceReturn(__pyx_r, 0);
16039 __Pyx_RefNannyFinishContext();
16052 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self);
16053 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
16054 PyObject *__pyx_r = 0;
16055 __Pyx_RefNannyDeclarations
16056 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
16057 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
16060 __Pyx_RefNannyFinishContext();
16064 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
16065 PyObject *__pyx_v_result = NULL;
16066 PyObject *__pyx_v_length = NULL;
16067 PyObject *__pyx_r = NULL;
16068 __Pyx_TraceDeclarations
16069 __Pyx_RefNannyDeclarations
16072 Py_ssize_t *__pyx_t_3;
16073 Py_ssize_t *__pyx_t_4;
16074 Py_ssize_t *__pyx_t_5;
16075 PyObject *__pyx_t_6 = NULL;
16076 int __pyx_lineno = 0;
16077 const char *__pyx_filename = NULL;
16078 int __pyx_clineno = 0;
16079 __Pyx_RefNannySetupContext(
"__get__", 0);
16080 __Pyx_TraceCall(
"__get__", __pyx_f[1], 596, 0, __PYX_ERR(1, 596, __pyx_L1_error));
16089 __Pyx_TraceLine(597,0,__PYX_ERR(1, 597, __pyx_L1_error))
16090 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
16091 __pyx_t_2 = (__pyx_t_1 != 0);
16101 __Pyx_TraceLine(598,0,__PYX_ERR(1, 598, __pyx_L1_error))
16102 __Pyx_INCREF(__pyx_int_1);
16103 __pyx_v_result = __pyx_int_1;
16112 __Pyx_TraceLine(600,0,__PYX_ERR(1, 600, __pyx_L1_error))
16113 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
16114 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
16115 __pyx_t_3 = __pyx_t_5;
16116 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0]));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 600, __pyx_L1_error)
16117 __Pyx_GOTREF(__pyx_t_6);
16118 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
16128 __Pyx_TraceLine(601,0,__PYX_ERR(1, 601, __pyx_L1_error))
16129 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 601, __pyx_L1_error)
16130 __Pyx_GOTREF(__pyx_t_6);
16131 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
16142 __Pyx_TraceLine(603,0,__PYX_ERR(1, 603, __pyx_L1_error))
16143 __Pyx_INCREF(__pyx_v_result);
16144 __Pyx_GIVEREF(__pyx_v_result);
16145 __Pyx_GOTREF(__pyx_v_self->_size);
16146 __Pyx_DECREF(__pyx_v_self->_size);
16147 __pyx_v_self->_size = __pyx_v_result;
16165 __Pyx_TraceLine(605,0,__PYX_ERR(1, 605, __pyx_L1_error))
16166 __Pyx_XDECREF(__pyx_r);
16167 __Pyx_INCREF(__pyx_v_self->_size);
16168 __pyx_r = __pyx_v_self->_size;
16181 __Pyx_XDECREF(__pyx_t_6);
16182 __Pyx_AddTraceback(
"View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16185 __Pyx_XDECREF(__pyx_v_result);
16186 __Pyx_XDECREF(__pyx_v_length);
16187 __Pyx_XGIVEREF(__pyx_r);
16188 __Pyx_TraceReturn(__pyx_r, 0);
16189 __Pyx_RefNannyFinishContext();
16202 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self);
16203 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
16204 Py_ssize_t __pyx_r;
16205 __Pyx_RefNannyDeclarations
16206 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
16207 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
16210 __Pyx_RefNannyFinishContext();
16214 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self) {
16215 Py_ssize_t __pyx_r;
16216 __Pyx_TraceDeclarations
16217 __Pyx_RefNannyDeclarations
16219 int __pyx_lineno = 0;
16220 const char *__pyx_filename = NULL;
16221 int __pyx_clineno = 0;
16222 __Pyx_RefNannySetupContext(
"__len__", 0);
16223 __Pyx_TraceCall(
"__len__", __pyx_f[1], 607, 0, __PYX_ERR(1, 607, __pyx_L1_error));
16232 __Pyx_TraceLine(608,0,__PYX_ERR(1, 608, __pyx_L1_error))
16233 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
16243 __Pyx_TraceLine(609,0,__PYX_ERR(1, 609, __pyx_L1_error))
16244 __pyx_r = (__pyx_v_self->view.shape[0]);
16263 __Pyx_TraceLine(611,0,__PYX_ERR(1, 611, __pyx_L1_error))
16277 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16280 __Pyx_TraceReturn(Py_None, 0);
16281 __Pyx_RefNannyFinishContext();
16294 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self);
16295 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
16296 PyObject *__pyx_r = 0;
16297 __Pyx_RefNannyDeclarations
16298 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
16299 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
16302 __Pyx_RefNannyFinishContext();
16306 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self) {
16307 PyObject *__pyx_r = NULL;
16308 __Pyx_TraceDeclarations
16309 __Pyx_RefNannyDeclarations
16310 PyObject *__pyx_t_1 = NULL;
16311 PyObject *__pyx_t_2 = NULL;
16312 PyObject *__pyx_t_3 = NULL;
16313 int __pyx_lineno = 0;
16314 const char *__pyx_filename = NULL;
16315 int __pyx_clineno = 0;
16316 __Pyx_RefNannySetupContext(
"__repr__", 0);
16317 __Pyx_TraceCall(
"__repr__", __pyx_f[1], 613, 0, __PYX_ERR(1, 613, __pyx_L1_error));
16326 __Pyx_TraceLine(614,0,__PYX_ERR(1, 614, __pyx_L1_error))
16327 __Pyx_XDECREF(__pyx_r);
16328 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 614, __pyx_L1_error)
16329 __Pyx_GOTREF(__pyx_t_1);
16330 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 614, __pyx_L1_error)
16331 __Pyx_GOTREF(__pyx_t_2);
16332 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16333 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 614, __pyx_L1_error)
16334 __Pyx_GOTREF(__pyx_t_1);
16335 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16344 __Pyx_TraceLine(615,0,__PYX_ERR(1, 615, __pyx_L1_error))
16345 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 615, __pyx_L1_error)
16346 __Pyx_GOTREF(__pyx_t_2);
16355 __Pyx_TraceLine(614,0,__PYX_ERR(1, 614, __pyx_L1_error))
16356 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 614, __pyx_L1_error)
16357 __Pyx_GOTREF(__pyx_t_3);
16358 __Pyx_GIVEREF(__pyx_t_1);
16359 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
16360 __Pyx_GIVEREF(__pyx_t_2);
16361 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
16364 __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 614, __pyx_L1_error)
16365 __Pyx_GOTREF(__pyx_t_2);
16366 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16367 __pyx_r = __pyx_t_2;
16381 __Pyx_XDECREF(__pyx_t_1);
16382 __Pyx_XDECREF(__pyx_t_2);
16383 __Pyx_XDECREF(__pyx_t_3);
16384 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16387 __Pyx_XGIVEREF(__pyx_r);
16388 __Pyx_TraceReturn(__pyx_r, 0);
16389 __Pyx_RefNannyFinishContext();
16402 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self);
16403 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
16404 PyObject *__pyx_r = 0;
16405 __Pyx_RefNannyDeclarations
16406 __Pyx_RefNannySetupContext(
"__str__ (wrapper)", 0);
16407 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
16410 __Pyx_RefNannyFinishContext();
16414 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self) {
16415 PyObject *__pyx_r = NULL;
16416 __Pyx_TraceDeclarations
16417 __Pyx_RefNannyDeclarations
16418 PyObject *__pyx_t_1 = NULL;
16419 PyObject *__pyx_t_2 = NULL;
16420 int __pyx_lineno = 0;
16421 const char *__pyx_filename = NULL;
16422 int __pyx_clineno = 0;
16423 __Pyx_RefNannySetupContext(
"__str__", 0);
16424 __Pyx_TraceCall(
"__str__", __pyx_f[1], 617, 0, __PYX_ERR(1, 617, __pyx_L1_error));
16433 __Pyx_TraceLine(618,0,__PYX_ERR(1, 618, __pyx_L1_error))
16434 __Pyx_XDECREF(__pyx_r);
16435 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error)
16436 __Pyx_GOTREF(__pyx_t_1);
16437 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error)
16438 __Pyx_GOTREF(__pyx_t_2);
16439 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16440 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error)
16441 __Pyx_GOTREF(__pyx_t_1);
16442 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16443 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error)
16444 __Pyx_GOTREF(__pyx_t_2);
16445 __Pyx_GIVEREF(__pyx_t_1);
16446 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
16448 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error)
16449 __Pyx_GOTREF(__pyx_t_1);
16450 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16451 __pyx_r = __pyx_t_1;
16465 __Pyx_XDECREF(__pyx_t_1);
16466 __Pyx_XDECREF(__pyx_t_2);
16467 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16470 __Pyx_XGIVEREF(__pyx_r);
16471 __Pyx_TraceReturn(__pyx_r, 0);
16472 __Pyx_RefNannyFinishContext();
16485 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
16486 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_17is_c_contig = {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0};
16487 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16488 PyObject *__pyx_r = 0;
16489 __Pyx_RefNannyDeclarations
16490 __Pyx_RefNannySetupContext(
"is_c_contig (wrapper)", 0);
16491 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
16494 __Pyx_RefNannyFinishContext();
16498 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
16499 __Pyx_memviewslice *__pyx_v_mslice;
16500 __Pyx_memviewslice __pyx_v_tmp;
16501 PyObject *__pyx_r = NULL;
16502 __Pyx_TraceDeclarations
16503 __Pyx_RefNannyDeclarations
16504 __Pyx_memviewslice *__pyx_t_1;
16505 PyObject *__pyx_t_2 = NULL;
16506 int __pyx_lineno = 0;
16507 const char *__pyx_filename = NULL;
16508 int __pyx_clineno = 0;
16509 __Pyx_RefNannySetupContext(
"is_c_contig", 0);
16510 __Pyx_TraceCall(
"is_c_contig", __pyx_f[1], 621, 0, __PYX_ERR(1, 621, __pyx_L1_error));
16519 __Pyx_TraceLine(624,0,__PYX_ERR(1, 624, __pyx_L1_error))
16520 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 624, __pyx_L1_error)
16521 __pyx_v_mslice = __pyx_t_1;
16530 __Pyx_TraceLine(625,0,__PYX_ERR(1, 625, __pyx_L1_error))
16531 __Pyx_XDECREF(__pyx_r);
16532 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'C', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 625, __pyx_L1_error)
16533 __Pyx_GOTREF(__pyx_t_2);
16534 __pyx_r = __pyx_t_2;
16548 __Pyx_XDECREF(__pyx_t_2);
16549 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
16552 __Pyx_XGIVEREF(__pyx_r);
16553 __Pyx_TraceReturn(__pyx_r, 0);
16554 __Pyx_RefNannyFinishContext();
16567 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
16568 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_19is_f_contig = {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0};
16569 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16570 PyObject *__pyx_r = 0;
16571 __Pyx_RefNannyDeclarations
16572 __Pyx_RefNannySetupContext(
"is_f_contig (wrapper)", 0);
16573 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
16576 __Pyx_RefNannyFinishContext();
16580 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
16581 __Pyx_memviewslice *__pyx_v_mslice;
16582 __Pyx_memviewslice __pyx_v_tmp;
16583 PyObject *__pyx_r = NULL;
16584 __Pyx_TraceDeclarations
16585 __Pyx_RefNannyDeclarations
16586 __Pyx_memviewslice *__pyx_t_1;
16587 PyObject *__pyx_t_2 = NULL;
16588 int __pyx_lineno = 0;
16589 const char *__pyx_filename = NULL;
16590 int __pyx_clineno = 0;
16591 __Pyx_RefNannySetupContext(
"is_f_contig", 0);
16592 __Pyx_TraceCall(
"is_f_contig", __pyx_f[1], 627, 0, __PYX_ERR(1, 627, __pyx_L1_error));
16601 __Pyx_TraceLine(630,0,__PYX_ERR(1, 630, __pyx_L1_error))
16602 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 630, __pyx_L1_error)
16603 __pyx_v_mslice = __pyx_t_1;
16612 __Pyx_TraceLine(631,0,__PYX_ERR(1, 631, __pyx_L1_error))
16613 __Pyx_XDECREF(__pyx_r);
16614 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'F', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 631, __pyx_L1_error)
16615 __Pyx_GOTREF(__pyx_t_2);
16616 __pyx_r = __pyx_t_2;
16630 __Pyx_XDECREF(__pyx_t_2);
16631 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
16634 __Pyx_XGIVEREF(__pyx_r);
16635 __Pyx_TraceReturn(__pyx_r, 0);
16636 __Pyx_RefNannyFinishContext();
16649 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
16650 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_21copy = {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0};
16651 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16652 PyObject *__pyx_r = 0;
16653 __Pyx_RefNannyDeclarations
16654 __Pyx_RefNannySetupContext(
"copy (wrapper)", 0);
16655 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((
struct __pyx_memoryview_obj *)__pyx_v_self));
16658 __Pyx_RefNannyFinishContext();
16662 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self) {
16663 __Pyx_memviewslice __pyx_v_mslice;
16665 PyObject *__pyx_r = NULL;
16666 __Pyx_TraceDeclarations
16667 __Pyx_RefNannyDeclarations
16668 __Pyx_memviewslice __pyx_t_1;
16669 PyObject *__pyx_t_2 = NULL;
16670 int __pyx_lineno = 0;
16671 const char *__pyx_filename = NULL;
16672 int __pyx_clineno = 0;
16673 __Pyx_RefNannySetupContext(
"copy", 0);
16674 __Pyx_TraceCall(
"copy", __pyx_f[1], 633, 0, __PYX_ERR(1, 633, __pyx_L1_error));
16683 __Pyx_TraceLine(635,0,__PYX_ERR(1, 635, __pyx_L1_error))
16684 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
16693 __Pyx_TraceLine(637,0,__PYX_ERR(1, 637, __pyx_L1_error))
16694 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
16703 __Pyx_TraceLine(638,0,__PYX_ERR(1, 638, __pyx_L1_error))
16704 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((
char *)
"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 638, __pyx_L1_error)
16705 __pyx_v_mslice = __pyx_t_1;
16714 __Pyx_TraceLine(643,0,__PYX_ERR(1, 643, __pyx_L1_error))
16715 __Pyx_XDECREF(__pyx_r);
16716 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 643, __pyx_L1_error)
16717 __Pyx_GOTREF(__pyx_t_2);
16718 __pyx_r = __pyx_t_2;
16732 __Pyx_XDECREF(__pyx_t_2);
16733 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
16736 __Pyx_XGIVEREF(__pyx_r);
16737 __Pyx_TraceReturn(__pyx_r, 0);
16738 __Pyx_RefNannyFinishContext();
16751 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
16752 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_23copy_fortran = {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0};
16753 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16754 PyObject *__pyx_r = 0;
16755 __Pyx_RefNannyDeclarations
16756 __Pyx_RefNannySetupContext(
"copy_fortran (wrapper)", 0);
16757 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((
struct __pyx_memoryview_obj *)__pyx_v_self));
16760 __Pyx_RefNannyFinishContext();
16764 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self) {
16765 __Pyx_memviewslice __pyx_v_src;
16766 __Pyx_memviewslice __pyx_v_dst;
16768 PyObject *__pyx_r = NULL;
16769 __Pyx_TraceDeclarations
16770 __Pyx_RefNannyDeclarations
16771 __Pyx_memviewslice __pyx_t_1;
16772 PyObject *__pyx_t_2 = NULL;
16773 int __pyx_lineno = 0;
16774 const char *__pyx_filename = NULL;
16775 int __pyx_clineno = 0;
16776 __Pyx_RefNannySetupContext(
"copy_fortran", 0);
16777 __Pyx_TraceCall(
"copy_fortran", __pyx_f[1], 645, 0, __PYX_ERR(1, 645, __pyx_L1_error));
16786 __Pyx_TraceLine(647,0,__PYX_ERR(1, 647, __pyx_L1_error))
16787 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
16796 __Pyx_TraceLine(649,0,__PYX_ERR(1, 649, __pyx_L1_error))
16797 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
16806 __Pyx_TraceLine(650,0,__PYX_ERR(1, 650, __pyx_L1_error))
16807 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((
char *)
"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 650, __pyx_L1_error)
16808 __pyx_v_dst = __pyx_t_1;
16817 __Pyx_TraceLine(655,0,__PYX_ERR(1, 655, __pyx_L1_error))
16818 __Pyx_XDECREF(__pyx_r);
16819 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 655, __pyx_L1_error)
16820 __Pyx_GOTREF(__pyx_t_2);
16821 __pyx_r = __pyx_t_2;
16835 __Pyx_XDECREF(__pyx_t_2);
16836 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
16839 __Pyx_XGIVEREF(__pyx_r);
16840 __Pyx_TraceReturn(__pyx_r, 0);
16841 __Pyx_RefNannyFinishContext();
16852 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
16853 static PyMethodDef __pyx_mdef___pyx_memoryview_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0};
16854 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16855 PyObject *__pyx_r = 0;
16856 __Pyx_RefNannyDeclarations
16857 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
16858 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
16861 __Pyx_RefNannyFinishContext();
16865 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self) {
16866 PyObject *__pyx_r = NULL;
16867 __Pyx_TraceDeclarations
16868 __Pyx_RefNannyDeclarations
16869 PyObject *__pyx_t_1 = NULL;
16870 int __pyx_lineno = 0;
16871 const char *__pyx_filename = NULL;
16872 int __pyx_clineno = 0;
16873 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
16874 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
16882 __Pyx_TraceLine(2,0,__PYX_ERR(1, 2, __pyx_L1_error))
16883 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
16884 __Pyx_GOTREF(__pyx_t_1);
16885 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16886 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16887 __PYX_ERR(1, 2, __pyx_L1_error)
16897 __Pyx_XDECREF(__pyx_t_1);
16898 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16900 __Pyx_XGIVEREF(__pyx_r);
16901 __Pyx_TraceReturn(__pyx_r, 0);
16902 __Pyx_RefNannyFinishContext();
16914 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
16915 static PyMethodDef __pyx_mdef___pyx_memoryview_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0};
16916 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16917 PyObject *__pyx_r = 0;
16918 __Pyx_RefNannyDeclarations
16919 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
16920 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16923 __Pyx_RefNannyFinishContext();
16927 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
16928 PyObject *__pyx_r = NULL;
16929 __Pyx_TraceDeclarations
16930 __Pyx_RefNannyDeclarations
16931 PyObject *__pyx_t_1 = NULL;
16932 int __pyx_lineno = 0;
16933 const char *__pyx_filename = NULL;
16934 int __pyx_clineno = 0;
16935 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
16936 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
16943 __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
16944 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
16945 __Pyx_GOTREF(__pyx_t_1);
16946 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16947 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16948 __PYX_ERR(1, 4, __pyx_L1_error)
16959 __Pyx_XDECREF(__pyx_t_1);
16960 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16962 __Pyx_XGIVEREF(__pyx_r);
16963 __Pyx_TraceReturn(__pyx_r, 0);
16964 __Pyx_RefNannyFinishContext();
16976 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o,
int __pyx_v_flags,
int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
16977 struct __pyx_memoryview_obj *__pyx_v_result = 0;
16978 PyObject *__pyx_r = NULL;
16979 __Pyx_TraceDeclarations
16980 __Pyx_RefNannyDeclarations
16981 PyObject *__pyx_t_1 = NULL;
16982 PyObject *__pyx_t_2 = NULL;
16983 PyObject *__pyx_t_3 = NULL;
16984 int __pyx_lineno = 0;
16985 const char *__pyx_filename = NULL;
16986 int __pyx_clineno = 0;
16987 __Pyx_RefNannySetupContext(
"memoryview_cwrapper", 0);
16988 __Pyx_TraceCall(
"memoryview_cwrapper", __pyx_f[1], 659, 0, __PYX_ERR(1, 659, __pyx_L1_error));
16997 __Pyx_TraceLine(660,0,__PYX_ERR(1, 660, __pyx_L1_error))
16998 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 660, __pyx_L1_error)
16999 __Pyx_GOTREF(__pyx_t_1);
17000 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 660, __pyx_L1_error)
17001 __Pyx_GOTREF(__pyx_t_2);
17002 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 660, __pyx_L1_error)
17003 __Pyx_GOTREF(__pyx_t_3);
17004 __Pyx_INCREF(__pyx_v_o);
17005 __Pyx_GIVEREF(__pyx_v_o);
17006 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
17007 __Pyx_GIVEREF(__pyx_t_1);
17008 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
17009 __Pyx_GIVEREF(__pyx_t_2);
17010 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
17013 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 660, __pyx_L1_error)
17014 __Pyx_GOTREF(__pyx_t_2);
17015 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17016 __pyx_v_result = ((
struct __pyx_memoryview_obj *)__pyx_t_2);
17026 __Pyx_TraceLine(661,0,__PYX_ERR(1, 661, __pyx_L1_error))
17027 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
17036 __Pyx_TraceLine(662,0,__PYX_ERR(1, 662, __pyx_L1_error))
17037 __Pyx_XDECREF(__pyx_r);
17038 __Pyx_INCREF(((PyObject *)__pyx_v_result));
17039 __pyx_r = ((PyObject *)__pyx_v_result);
17052 __Pyx_XDECREF(__pyx_t_1);
17053 __Pyx_XDECREF(__pyx_t_2);
17054 __Pyx_XDECREF(__pyx_t_3);
17055 __Pyx_AddTraceback(
"View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
17058 __Pyx_XDECREF((PyObject *)__pyx_v_result);
17059 __Pyx_XGIVEREF(__pyx_r);
17060 __Pyx_TraceReturn(__pyx_r, 0);
17061 __Pyx_RefNannyFinishContext();
17073 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *__pyx_v_o) {
17075 __Pyx_TraceDeclarations
17076 __Pyx_RefNannyDeclarations
17078 int __pyx_lineno = 0;
17079 const char *__pyx_filename = NULL;
17080 int __pyx_clineno = 0;
17081 __Pyx_RefNannySetupContext(
"memoryview_check", 0);
17082 __Pyx_TraceCall(
"memoryview_check", __pyx_f[1], 665, 0, __PYX_ERR(1, 665, __pyx_L1_error));
17091 __Pyx_TraceLine(666,0,__PYX_ERR(1, 666, __pyx_L1_error))
17092 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
17093 __pyx_r = __pyx_t_1;
17106 __Pyx_WriteUnraisable(
"View.MemoryView.memoryview_check", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
17109 __Pyx_TraceReturn(Py_None, 0);
17110 __Pyx_RefNannyFinishContext();
17122 static PyObject *_unellipsify(PyObject *__pyx_v_index,
int __pyx_v_ndim) {
17123 PyObject *__pyx_v_tup = NULL;
17124 PyObject *__pyx_v_result = NULL;
17125 int __pyx_v_have_slices;
17126 int __pyx_v_seen_ellipsis;
17127 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
17128 PyObject *__pyx_v_item = NULL;
17129 Py_ssize_t __pyx_v_nslices;
17130 PyObject *__pyx_r = NULL;
17131 __Pyx_TraceDeclarations
17132 __Pyx_RefNannyDeclarations
17135 PyObject *__pyx_t_3 = NULL;
17136 PyObject *__pyx_t_4 = NULL;
17137 Py_ssize_t __pyx_t_5;
17138 PyObject *(*__pyx_t_6)(PyObject *);
17139 PyObject *__pyx_t_7 = NULL;
17140 Py_ssize_t __pyx_t_8;
17143 PyObject *__pyx_t_11 = NULL;
17144 int __pyx_lineno = 0;
17145 const char *__pyx_filename = NULL;
17146 int __pyx_clineno = 0;
17147 __Pyx_RefNannySetupContext(
"_unellipsify", 0);
17148 __Pyx_TraceCall(
"_unellipsify", __pyx_f[1], 668, 0, __PYX_ERR(1, 668, __pyx_L1_error));
17157 __Pyx_TraceLine(673,0,__PYX_ERR(1, 673, __pyx_L1_error))
17158 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
17159 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
17169 __Pyx_TraceLine(674,0,__PYX_ERR(1, 674, __pyx_L1_error))
17170 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 674, __pyx_L1_error)
17171 __Pyx_GOTREF(__pyx_t_3);
17172 __Pyx_INCREF(__pyx_v_index);
17173 __Pyx_GIVEREF(__pyx_v_index);
17174 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
17175 __pyx_v_tup = __pyx_t_3;
17195 __Pyx_TraceLine(676,0,__PYX_ERR(1, 676, __pyx_L1_error))
17197 __Pyx_INCREF(__pyx_v_index);
17198 __pyx_v_tup = __pyx_v_index;
17209 __Pyx_TraceLine(678,0,__PYX_ERR(1, 678, __pyx_L1_error))
17210 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error)
17211 __Pyx_GOTREF(__pyx_t_3);
17212 __pyx_v_result = ((PyObject*)__pyx_t_3);
17222 __Pyx_TraceLine(679,0,__PYX_ERR(1, 679, __pyx_L1_error))
17223 __pyx_v_have_slices = 0;
17232 __Pyx_TraceLine(680,0,__PYX_ERR(1, 680, __pyx_L1_error))
17233 __pyx_v_seen_ellipsis = 0;
17242 __Pyx_TraceLine(681,0,__PYX_ERR(1, 681, __pyx_L1_error))
17243 __Pyx_INCREF(__pyx_int_0);
17244 __pyx_t_3 = __pyx_int_0;
17245 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
17246 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
17249 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 681, __pyx_L1_error)
17250 __Pyx_GOTREF(__pyx_t_4);
17251 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 681, __pyx_L1_error)
17254 if (likely(!__pyx_t_6)) {
17255 if (likely(PyList_CheckExact(__pyx_t_4))) {
17256 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4))
break;
17257 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17258 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 681, __pyx_L1_error)
17260 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 681, __pyx_L1_error)
17261 __Pyx_GOTREF(__pyx_t_7);
17264 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
17265 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17266 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 681, __pyx_L1_error)
17268 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 681, __pyx_L1_error)
17269 __Pyx_GOTREF(__pyx_t_7);
17273 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
17274 if (unlikely(!__pyx_t_7)) {
17275 PyObject* exc_type = PyErr_Occurred();
17277 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
17278 else __PYX_ERR(1, 681, __pyx_L1_error)
17282 __Pyx_GOTREF(__pyx_t_7);
17284 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
17286 __Pyx_INCREF(__pyx_t_3);
17287 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
17288 __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 681, __pyx_L1_error)
17289 __Pyx_GOTREF(__pyx_t_7);
17290 __Pyx_DECREF(__pyx_t_3);
17291 __pyx_t_3 = __pyx_t_7;
17301 __Pyx_TraceLine(682,0,__PYX_ERR(1, 682, __pyx_L1_error))
17302 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
17303 __pyx_t_1 = (__pyx_t_2 != 0);
17313 __Pyx_TraceLine(683,0,__PYX_ERR(1, 683, __pyx_L1_error))
17314 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
17324 __Pyx_TraceLine(684,0,__PYX_ERR(1, 684, __pyx_L1_error))
17325 __pyx_t_8 = PyObject_Length(__pyx_v_tup);
if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 684, __pyx_L1_error)
17326 __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 684, __pyx_L1_error)
17327 __Pyx_GOTREF(__pyx_t_7);
17328 { Py_ssize_t __pyx_temp;
17329 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
17330 __Pyx_INCREF(__pyx_slice__4);
17331 __Pyx_GIVEREF(__pyx_slice__4);
17332 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__4);
17335 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 684, __pyx_L1_error)
17336 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17345 __Pyx_TraceLine(685,0,__PYX_ERR(1, 685, __pyx_L1_error))
17346 __pyx_v_seen_ellipsis = 1;
17365 __Pyx_TraceLine(687,0,__PYX_ERR(1, 687, __pyx_L1_error))
17367 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__4);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 687, __pyx_L1_error)
17378 __Pyx_TraceLine(688,0,__PYX_ERR(1, 688, __pyx_L1_error))
17379 __pyx_v_have_slices = 1;
17398 __Pyx_TraceLine(690,0,__PYX_ERR(1, 690, __pyx_L1_error))
17400 __pyx_t_2 = PySlice_Check(__pyx_v_item);
17401 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
17404 __pyx_t_1 = __pyx_t_10;
17405 goto __pyx_L9_bool_binop_done;
17407 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
17408 __pyx_t_1 = __pyx_t_10;
17409 __pyx_L9_bool_binop_done:;
17410 if (unlikely(__pyx_t_1)) {
17419 __Pyx_TraceLine(691,0,__PYX_ERR(1, 691, __pyx_L1_error))
17420 __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 691, __pyx_L1_error)
17421 __Pyx_GOTREF(__pyx_t_7);
17422 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 691, __pyx_L1_error)
17423 __Pyx_GOTREF(__pyx_t_11);
17424 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17425 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
17426 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
17427 __PYX_ERR(1, 691, __pyx_L1_error)
17445 __Pyx_TraceLine(693,0,__PYX_ERR(1, 693, __pyx_L1_error))
17446 __pyx_t_10 = (__pyx_v_have_slices != 0);
17449 __pyx_t_1 = __pyx_t_10;
17450 goto __pyx_L11_bool_binop_done;
17452 __pyx_t_10 = PySlice_Check(__pyx_v_item);
17453 __pyx_t_2 = (__pyx_t_10 != 0);
17454 __pyx_t_1 = __pyx_t_2;
17455 __pyx_L11_bool_binop_done:;
17456 __pyx_v_have_slices = __pyx_t_1;
17465 __Pyx_TraceLine(694,0,__PYX_ERR(1, 694, __pyx_L1_error))
17466 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
17477 __Pyx_TraceLine(681,0,__PYX_ERR(1, 681, __pyx_L1_error))
17479 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17480 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17489 __Pyx_TraceLine(696,0,__PYX_ERR(1, 696, __pyx_L1_error))
17490 __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result);
if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
17491 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
17500 __Pyx_TraceLine(697,0,__PYX_ERR(1, 697, __pyx_L1_error))
17501 __pyx_t_1 = (__pyx_v_nslices != 0);
17511 __Pyx_TraceLine(698,0,__PYX_ERR(1, 698, __pyx_L1_error))
17512 __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error)
17513 __Pyx_GOTREF(__pyx_t_3);
17514 { Py_ssize_t __pyx_temp;
17515 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
17516 __Pyx_INCREF(__pyx_slice__4);
17517 __Pyx_GIVEREF(__pyx_slice__4);
17518 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__4);
17521 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 698, __pyx_L1_error)
17522 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17540 __Pyx_TraceLine(700,0,__PYX_ERR(1, 700, __pyx_L1_error))
17541 __Pyx_XDECREF(__pyx_r);
17542 if (!__pyx_v_have_slices) {
17544 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 700, __pyx_L1_error)
17545 __Pyx_GOTREF(__pyx_t_4);
17546 __pyx_t_3 = __pyx_t_4;
17548 goto __pyx_L14_bool_binop_done;
17550 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 700, __pyx_L1_error)
17551 __Pyx_GOTREF(__pyx_t_4);
17552 __pyx_t_3 = __pyx_t_4;
17554 __pyx_L14_bool_binop_done:;
17555 __pyx_t_4 = PyList_AsTuple(__pyx_v_result);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 700, __pyx_L1_error)
17556 __Pyx_GOTREF(__pyx_t_4);
17557 __pyx_t_11 = PyTuple_New(2);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 700, __pyx_L1_error)
17558 __Pyx_GOTREF(__pyx_t_11);
17559 __Pyx_GIVEREF(__pyx_t_3);
17560 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
17561 __Pyx_GIVEREF(__pyx_t_4);
17562 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
17565 __pyx_r = ((PyObject*)__pyx_t_11);
17579 __Pyx_XDECREF(__pyx_t_3);
17580 __Pyx_XDECREF(__pyx_t_4);
17581 __Pyx_XDECREF(__pyx_t_7);
17582 __Pyx_XDECREF(__pyx_t_11);
17583 __Pyx_AddTraceback(
"View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
17586 __Pyx_XDECREF(__pyx_v_tup);
17587 __Pyx_XDECREF(__pyx_v_result);
17588 __Pyx_XDECREF(__pyx_v_idx);
17589 __Pyx_XDECREF(__pyx_v_item);
17590 __Pyx_XGIVEREF(__pyx_r);
17591 __Pyx_TraceReturn(__pyx_r, 0);
17592 __Pyx_RefNannyFinishContext();
17604 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets,
int __pyx_v_ndim) {
17605 Py_ssize_t __pyx_v_suboffset;
17606 PyObject *__pyx_r = NULL;
17607 __Pyx_TraceDeclarations
17608 __Pyx_RefNannyDeclarations
17609 Py_ssize_t *__pyx_t_1;
17610 Py_ssize_t *__pyx_t_2;
17611 Py_ssize_t *__pyx_t_3;
17613 PyObject *__pyx_t_5 = NULL;
17614 int __pyx_lineno = 0;
17615 const char *__pyx_filename = NULL;
17616 int __pyx_clineno = 0;
17617 __Pyx_RefNannySetupContext(
"assert_direct_dimensions", 0);
17618 __Pyx_TraceCall(
"assert_direct_dimensions", __pyx_f[1], 702, 0, __PYX_ERR(1, 702, __pyx_L1_error));
17627 __Pyx_TraceLine(703,0,__PYX_ERR(1, 703, __pyx_L1_error))
17628 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
17629 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
17630 __pyx_t_1 = __pyx_t_3;
17631 __pyx_v_suboffset = (__pyx_t_1[0]);
17640 __Pyx_TraceLine(704,0,__PYX_ERR(1, 704, __pyx_L1_error))
17641 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
17642 if (unlikely(__pyx_t_4)) {
17651 __Pyx_TraceLine(705,0,__PYX_ERR(1, 705, __pyx_L1_error))
17652 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 705, __pyx_L1_error)
17653 __Pyx_GOTREF(__pyx_t_5);
17654 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
17655 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17656 __PYX_ERR(1, 705, __pyx_L1_error)
17677 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17680 __Pyx_XDECREF(__pyx_t_5);
17681 __Pyx_AddTraceback(
"View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
17684 __Pyx_XGIVEREF(__pyx_r);
17685 __Pyx_TraceReturn(__pyx_r, 0);
17686 __Pyx_RefNannyFinishContext();
17698 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
17699 int __pyx_v_new_ndim;
17700 int __pyx_v_suboffset_dim;
17702 __Pyx_memviewslice __pyx_v_src;
17703 __Pyx_memviewslice __pyx_v_dst;
17704 __Pyx_memviewslice *__pyx_v_p_src;
17705 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
17706 __Pyx_memviewslice *__pyx_v_p_dst;
17707 int *__pyx_v_p_suboffset_dim;
17708 Py_ssize_t __pyx_v_start;
17709 Py_ssize_t __pyx_v_stop;
17710 Py_ssize_t __pyx_v_step;
17711 int __pyx_v_have_start;
17712 int __pyx_v_have_stop;
17713 int __pyx_v_have_step;
17714 PyObject *__pyx_v_index = NULL;
17715 struct __pyx_memoryview_obj *__pyx_r = NULL;
17716 __Pyx_TraceDeclarations
17717 __Pyx_RefNannyDeclarations
17720 PyObject *__pyx_t_3 = NULL;
17721 struct __pyx_memoryview_obj *__pyx_t_4;
17724 Py_ssize_t __pyx_t_7;
17725 PyObject *(*__pyx_t_8)(PyObject *);
17726 PyObject *__pyx_t_9 = NULL;
17727 Py_ssize_t __pyx_t_10;
17729 Py_ssize_t __pyx_t_12;
17730 int __pyx_lineno = 0;
17731 const char *__pyx_filename = NULL;
17732 int __pyx_clineno = 0;
17733 __Pyx_RefNannySetupContext(
"memview_slice", 0);
17734 __Pyx_TraceCall(
"memview_slice", __pyx_f[1], 712, 0, __PYX_ERR(1, 712, __pyx_L1_error));
17743 __Pyx_TraceLine(713,0,__PYX_ERR(1, 713, __pyx_L1_error))
17744 __pyx_v_new_ndim = 0;
17745 __pyx_v_suboffset_dim = -1;
17754 __Pyx_TraceLine(720,0,__PYX_ERR(1, 720, __pyx_L1_error))
17755 (void)(memset((&__pyx_v_dst), 0, (
sizeof(__pyx_v_dst))));
17764 __Pyx_TraceLine(724,0,__PYX_ERR(1, 724, __pyx_L1_error))
17765 #ifndef CYTHON_WITHOUT_ASSERTIONS
17766 if (unlikely(__pyx_assertions_enabled())) {
17767 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
17768 PyErr_SetNone(PyExc_AssertionError);
17769 __PYX_ERR(1, 724, __pyx_L1_error)
17781 __Pyx_TraceLine(726,0,__PYX_ERR(1, 726, __pyx_L1_error))
17782 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17783 __pyx_t_2 = (__pyx_t_1 != 0);
17793 __Pyx_TraceLine(727,0,__PYX_ERR(1, 727, __pyx_L1_error))
17794 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error)
17795 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
17796 __Pyx_INCREF(__pyx_t_3);
17797 __pyx_v_memviewsliceobj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
17807 __Pyx_TraceLine(728,0,__PYX_ERR(1, 728, __pyx_L1_error))
17808 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
17827 __Pyx_TraceLine(730,0,__PYX_ERR(1, 730, __pyx_L1_error))
17829 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
17838 __Pyx_TraceLine(731,0,__PYX_ERR(1, 731, __pyx_L1_error))
17839 __pyx_v_p_src = (&__pyx_v_src);
17850 __Pyx_TraceLine(737,0,__PYX_ERR(1, 737, __pyx_L1_error))
17851 __pyx_t_4 = __pyx_v_p_src->memview;
17852 __pyx_v_dst.memview = __pyx_t_4;
17861 __Pyx_TraceLine(738,0,__PYX_ERR(1, 738, __pyx_L1_error))
17862 __pyx_t_5 = __pyx_v_p_src->data;
17863 __pyx_v_dst.data = __pyx_t_5;
17872 __Pyx_TraceLine(743,0,__PYX_ERR(1, 743, __pyx_L1_error))
17873 __pyx_v_p_dst = (&__pyx_v_dst);
17882 __Pyx_TraceLine(744,0,__PYX_ERR(1, 744, __pyx_L1_error))
17883 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
17892 __Pyx_TraceLine(748,0,__PYX_ERR(1, 748, __pyx_L1_error))
17894 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
17895 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
17898 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 748, __pyx_L1_error)
17899 __Pyx_GOTREF(__pyx_t_3);
17900 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error)
17903 if (likely(!__pyx_t_8)) {
17904 if (likely(PyList_CheckExact(__pyx_t_3))) {
17905 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3))
break;
17906 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17907 __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 748, __pyx_L1_error)
17909 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 748, __pyx_L1_error)
17910 __Pyx_GOTREF(__pyx_t_9);
17913 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
17914 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17915 __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 748, __pyx_L1_error)
17917 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 748, __pyx_L1_error)
17918 __Pyx_GOTREF(__pyx_t_9);
17922 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
17923 if (unlikely(!__pyx_t_9)) {
17924 PyObject* exc_type = PyErr_Occurred();
17926 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
17927 else __PYX_ERR(1, 748, __pyx_L1_error)
17931 __Pyx_GOTREF(__pyx_t_9);
17933 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
17935 __pyx_v_dim = __pyx_t_6;
17936 __pyx_t_6 = (__pyx_t_6 + 1);
17945 __Pyx_TraceLine(749,0,__PYX_ERR(1, 749, __pyx_L1_error))
17946 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
17956 __Pyx_TraceLine(753,0,__PYX_ERR(1, 753, __pyx_L1_error))
17957 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index);
if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 753, __pyx_L1_error)
17966 __Pyx_TraceLine(750,0,__PYX_ERR(1, 750, __pyx_L1_error))
17967 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 750, __pyx_L1_error)
17986 __Pyx_TraceLine(756,0,__PYX_ERR(1, 756, __pyx_L1_error))
17987 __pyx_t_2 = (__pyx_v_index == Py_None);
17988 __pyx_t_1 = (__pyx_t_2 != 0);
17998 __Pyx_TraceLine(757,0,__PYX_ERR(1, 757, __pyx_L1_error))
17999 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
18008 __Pyx_TraceLine(758,0,__PYX_ERR(1, 758, __pyx_L1_error))
18009 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
18018 __Pyx_TraceLine(759,0,__PYX_ERR(1, 759, __pyx_L1_error))
18019 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
18028 __Pyx_TraceLine(760,0,__PYX_ERR(1, 760, __pyx_L1_error))
18029 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
18048 __Pyx_TraceLine(762,0,__PYX_ERR(1, 762, __pyx_L1_error))
18050 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
18051 __Pyx_GOTREF(__pyx_t_9);
18052 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
18054 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18056 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
18057 __pyx_t_10 = __pyx_t_12;
18058 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18059 goto __pyx_L7_bool_binop_done;
18062 __pyx_L7_bool_binop_done:;
18063 __pyx_v_start = __pyx_t_10;
18072 __Pyx_TraceLine(763,0,__PYX_ERR(1, 763, __pyx_L1_error))
18073 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 763, __pyx_L1_error)
18074 __Pyx_GOTREF(__pyx_t_9);
18075 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 763, __pyx_L1_error)
18077 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18079 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error)
18080 __pyx_t_10 = __pyx_t_12;
18081 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18082 goto __pyx_L9_bool_binop_done;
18085 __pyx_L9_bool_binop_done:;
18086 __pyx_v_stop = __pyx_t_10;
18095 __Pyx_TraceLine(764,0,__PYX_ERR(1, 764, __pyx_L1_error))
18096 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
18097 __Pyx_GOTREF(__pyx_t_9);
18098 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 764, __pyx_L1_error)
18100 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18102 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error)
18103 __pyx_t_10 = __pyx_t_12;
18104 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18105 goto __pyx_L11_bool_binop_done;
18108 __pyx_L11_bool_binop_done:;
18109 __pyx_v_step = __pyx_t_10;
18118 __Pyx_TraceLine(766,0,__PYX_ERR(1, 766, __pyx_L1_error))
18119 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
18120 __Pyx_GOTREF(__pyx_t_9);
18121 __pyx_t_1 = (__pyx_t_9 != Py_None);
18122 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18123 __pyx_v_have_start = __pyx_t_1;
18132 __Pyx_TraceLine(767,0,__PYX_ERR(1, 767, __pyx_L1_error))
18133 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 767, __pyx_L1_error)
18134 __Pyx_GOTREF(__pyx_t_9);
18135 __pyx_t_1 = (__pyx_t_9 != Py_None);
18136 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18137 __pyx_v_have_stop = __pyx_t_1;
18146 __Pyx_TraceLine(768,0,__PYX_ERR(1, 768, __pyx_L1_error))
18147 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 768, __pyx_L1_error)
18148 __Pyx_GOTREF(__pyx_t_9);
18149 __pyx_t_1 = (__pyx_t_9 != Py_None);
18150 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18151 __pyx_v_have_step = __pyx_t_1;
18160 __Pyx_TraceLine(770,0,__PYX_ERR(1, 770, __pyx_L1_error))
18161 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 770, __pyx_L1_error)
18170 __Pyx_TraceLine(776,0,__PYX_ERR(1, 776, __pyx_L1_error))
18171 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
18182 __Pyx_TraceLine(748,0,__PYX_ERR(1, 748, __pyx_L1_error))
18184 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18193 __Pyx_TraceLine(778,0,__PYX_ERR(1, 778, __pyx_L1_error))
18194 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
18195 __pyx_t_2 = (__pyx_t_1 != 0);
18205 __Pyx_TraceLine(779,0,__PYX_ERR(1, 779, __pyx_L1_error))
18206 __Pyx_XDECREF(((PyObject *)__pyx_r));
18215 __Pyx_TraceLine(780,0,__PYX_ERR(1, 780, __pyx_L1_error))
18216 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) }
18225 __Pyx_TraceLine(781,0,__PYX_ERR(1, 781, __pyx_L1_error))
18226 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) }
18235 __Pyx_TraceLine(779,0,__PYX_ERR(1, 779, __pyx_L1_error))
18236 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 779, __pyx_L1_error)
18237 __Pyx_GOTREF(__pyx_t_3);
18238 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error)
18239 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
18259 __Pyx_TraceLine(784,0,__PYX_ERR(1, 784, __pyx_L1_error))
18261 __Pyx_XDECREF(((PyObject *)__pyx_r));
18270 __Pyx_TraceLine(785,0,__PYX_ERR(1, 785, __pyx_L1_error))
18271 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 784, __pyx_L1_error)
18272 __Pyx_GOTREF(__pyx_t_3);
18281 __Pyx_TraceLine(784,0,__PYX_ERR(1, 784, __pyx_L1_error))
18282 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error)
18283 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
18298 __Pyx_XDECREF(__pyx_t_3);
18299 __Pyx_XDECREF(__pyx_t_9);
18300 __Pyx_AddTraceback(
"View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18303 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
18304 __Pyx_XDECREF(__pyx_v_index);
18305 __Pyx_XGIVEREF((PyObject *)__pyx_r);
18306 __Pyx_TraceReturn(__pyx_r, 0);
18307 __Pyx_RefNannyFinishContext();
18319 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset,
int __pyx_v_dim,
int __pyx_v_new_ndim,
int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step,
int __pyx_v_have_start,
int __pyx_v_have_stop,
int __pyx_v_have_step,
int __pyx_v_is_slice) {
18320 Py_ssize_t __pyx_v_new_shape;
18321 int __pyx_v_negative_step;
18323 __Pyx_TraceDeclarations
18327 int __pyx_lineno = 0;
18328 const char *__pyx_filename = NULL;
18329 int __pyx_clineno = 0;
18330 __Pyx_TraceCall(
"slice_memviewslice", __pyx_f[1], 809, 1, __PYX_ERR(1, 809, __pyx_L1_error));
18339 __Pyx_TraceLine(829,1,__PYX_ERR(1, 829, __pyx_L1_error))
18340 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
18350 __Pyx_TraceLine(831,1,__PYX_ERR(1, 831, __pyx_L1_error))
18351 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
18361 __Pyx_TraceLine(832,1,__PYX_ERR(1, 832, __pyx_L1_error))
18362 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
18380 __Pyx_TraceLine(833,1,__PYX_ERR(1, 833, __pyx_L1_error))
18381 __pyx_t_1 = (0 <= __pyx_v_start);
18383 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
18385 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
18395 __Pyx_TraceLine(834,1,__PYX_ERR(1, 834, __pyx_L1_error))
18396 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"Index out of bounds (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 834, __pyx_L1_error)
18424 __Pyx_TraceLine(837,1,__PYX_ERR(1, 837, __pyx_L1_error))
18426 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
18429 __pyx_t_2 = __pyx_t_1;
18430 goto __pyx_L6_bool_binop_done;
18432 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
18433 __pyx_t_2 = __pyx_t_1;
18434 __pyx_L6_bool_binop_done:;
18435 __pyx_v_negative_step = __pyx_t_2;
18444 __Pyx_TraceLine(839,1,__PYX_ERR(1, 839, __pyx_L1_error))
18445 __pyx_t_1 = (__pyx_v_have_step != 0);
18448 __pyx_t_2 = __pyx_t_1;
18449 goto __pyx_L9_bool_binop_done;
18451 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
18452 __pyx_t_2 = __pyx_t_1;
18453 __pyx_L9_bool_binop_done:;
18463 __Pyx_TraceLine(840,1,__PYX_ERR(1, 840, __pyx_L1_error))
18464 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Step may not be zero (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 840, __pyx_L1_error)
18482 __Pyx_TraceLine(843,1,__PYX_ERR(1, 843, __pyx_L1_error))
18483 __pyx_t_2 = (__pyx_v_have_start != 0);
18493 __Pyx_TraceLine(844,1,__PYX_ERR(1, 844, __pyx_L1_error))
18494 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
18504 __Pyx_TraceLine(845,1,__PYX_ERR(1, 845, __pyx_L1_error))
18505 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
18514 __Pyx_TraceLine(846,1,__PYX_ERR(1, 846, __pyx_L1_error))
18515 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
18525 __Pyx_TraceLine(847,1,__PYX_ERR(1, 847, __pyx_L1_error))
18554 __Pyx_TraceLine(848,1,__PYX_ERR(1, 848, __pyx_L1_error))
18555 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
18565 __Pyx_TraceLine(849,1,__PYX_ERR(1, 849, __pyx_L1_error))
18566 __pyx_t_2 = (__pyx_v_negative_step != 0);
18576 __Pyx_TraceLine(850,1,__PYX_ERR(1, 850, __pyx_L1_error))
18577 __pyx_v_start = (__pyx_v_shape - 1);
18596 __Pyx_TraceLine(852,1,__PYX_ERR(1, 852, __pyx_L1_error))
18598 __pyx_v_start = __pyx_v_shape;
18629 __Pyx_TraceLine(854,1,__PYX_ERR(1, 854, __pyx_L1_error))
18631 __pyx_t_2 = (__pyx_v_negative_step != 0);
18641 __Pyx_TraceLine(855,1,__PYX_ERR(1, 855, __pyx_L1_error))
18642 __pyx_v_start = (__pyx_v_shape - 1);
18661 __Pyx_TraceLine(857,1,__PYX_ERR(1, 857, __pyx_L1_error))
18676 __Pyx_TraceLine(859,1,__PYX_ERR(1, 859, __pyx_L1_error))
18677 __pyx_t_2 = (__pyx_v_have_stop != 0);
18687 __Pyx_TraceLine(860,1,__PYX_ERR(1, 860, __pyx_L1_error))
18688 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
18698 __Pyx_TraceLine(861,1,__PYX_ERR(1, 861, __pyx_L1_error))
18699 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
18708 __Pyx_TraceLine(862,1,__PYX_ERR(1, 862, __pyx_L1_error))
18709 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
18719 __Pyx_TraceLine(863,1,__PYX_ERR(1, 863, __pyx_L1_error))
18748 __Pyx_TraceLine(864,1,__PYX_ERR(1, 864, __pyx_L1_error))
18749 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
18759 __Pyx_TraceLine(865,1,__PYX_ERR(1, 865, __pyx_L1_error))
18760 __pyx_v_stop = __pyx_v_shape;
18789 __Pyx_TraceLine(867,1,__PYX_ERR(1, 867, __pyx_L1_error))
18791 __pyx_t_2 = (__pyx_v_negative_step != 0);
18801 __Pyx_TraceLine(868,1,__PYX_ERR(1, 868, __pyx_L1_error))
18802 __pyx_v_stop = -1L;
18821 __Pyx_TraceLine(870,1,__PYX_ERR(1, 870, __pyx_L1_error))
18823 __pyx_v_stop = __pyx_v_shape;
18836 __Pyx_TraceLine(872,1,__PYX_ERR(1, 872, __pyx_L1_error))
18837 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
18847 __Pyx_TraceLine(873,1,__PYX_ERR(1, 873, __pyx_L1_error))
18866 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
18875 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
18885 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
18903 __Pyx_TraceLine(882,1,__PYX_ERR(1, 882, __pyx_L1_error))
18904 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
18914 __Pyx_TraceLine(883,1,__PYX_ERR(1, 883, __pyx_L1_error))
18915 __pyx_v_new_shape = 0;
18933 __Pyx_TraceLine(886,1,__PYX_ERR(1, 886, __pyx_L1_error))
18934 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
18943 __Pyx_TraceLine(887,1,__PYX_ERR(1, 887, __pyx_L1_error))
18944 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
18953 __Pyx_TraceLine(888,1,__PYX_ERR(1, 888, __pyx_L1_error))
18954 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
18965 __Pyx_TraceLine(891,1,__PYX_ERR(1, 891, __pyx_L1_error))
18966 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
18976 __Pyx_TraceLine(892,1,__PYX_ERR(1, 892, __pyx_L1_error))
18977 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
18996 __Pyx_TraceLine(894,1,__PYX_ERR(1, 894, __pyx_L1_error))
18998 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
18999 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
19010 __Pyx_TraceLine(896,1,__PYX_ERR(1, 896, __pyx_L1_error))
19011 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
19021 __Pyx_TraceLine(897,1,__PYX_ERR(1, 897, __pyx_L1_error))
19022 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
19032 __Pyx_TraceLine(898,1,__PYX_ERR(1, 898, __pyx_L1_error))
19033 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
19043 __Pyx_TraceLine(899,1,__PYX_ERR(1, 899, __pyx_L1_error))
19044 __pyx_v_dst->data = ((((
char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
19063 __Pyx_TraceLine(901,1,__PYX_ERR(1, 901, __pyx_L1_error))
19073 __Pyx_TraceLine(902,1,__PYX_ERR(1, 902, __pyx_L1_error))
19074 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 901, __pyx_L1_error)
19095 __Pyx_TraceLine(904,1,__PYX_ERR(1, 904, __pyx_L1_error))
19097 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
19117 __Pyx_TraceLine(906,1,__PYX_ERR(1, 906, __pyx_L1_error))
19133 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19135 __Pyx_AddTraceback(
"View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
19137 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19142 __Pyx_TraceReturn(Py_None, 1);
19154 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view,
char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
19155 Py_ssize_t __pyx_v_shape;
19156 Py_ssize_t __pyx_v_stride;
19157 Py_ssize_t __pyx_v_suboffset;
19158 Py_ssize_t __pyx_v_itemsize;
19159 char *__pyx_v_resultp;
19161 __Pyx_TraceDeclarations
19162 __Pyx_RefNannyDeclarations
19163 Py_ssize_t __pyx_t_1;
19165 PyObject *__pyx_t_3 = NULL;
19166 PyObject *__pyx_t_4 = NULL;
19167 int __pyx_lineno = 0;
19168 const char *__pyx_filename = NULL;
19169 int __pyx_clineno = 0;
19170 __Pyx_RefNannySetupContext(
"pybuffer_index", 0);
19171 __Pyx_TraceCall(
"pybuffer_index", __pyx_f[1], 912, 0, __PYX_ERR(1, 912, __pyx_L1_error));
19180 __Pyx_TraceLine(914,0,__PYX_ERR(1, 914, __pyx_L1_error))
19181 __pyx_v_suboffset = -1L;
19190 __Pyx_TraceLine(915,0,__PYX_ERR(1, 915, __pyx_L1_error))
19191 __pyx_t_1 = __pyx_v_view->itemsize;
19192 __pyx_v_itemsize = __pyx_t_1;
19201 __Pyx_TraceLine(918,0,__PYX_ERR(1, 918, __pyx_L1_error))
19202 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
19212 __Pyx_TraceLine(919,0,__PYX_ERR(1, 919, __pyx_L1_error))
19213 if (unlikely(__pyx_v_itemsize == 0)) {
19214 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
19215 __PYX_ERR(1, 919, __pyx_L1_error)
19217 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
19218 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
19219 __PYX_ERR(1, 919, __pyx_L1_error)
19221 __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
19230 __Pyx_TraceLine(920,0,__PYX_ERR(1, 920, __pyx_L1_error))
19231 __pyx_v_stride = __pyx_v_itemsize;
19250 __Pyx_TraceLine(922,0,__PYX_ERR(1, 922, __pyx_L1_error))
19252 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
19261 __Pyx_TraceLine(923,0,__PYX_ERR(1, 923, __pyx_L1_error))
19262 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
19271 __Pyx_TraceLine(924,0,__PYX_ERR(1, 924, __pyx_L1_error))
19272 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
19282 __Pyx_TraceLine(925,0,__PYX_ERR(1, 925, __pyx_L1_error))
19283 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
19303 __Pyx_TraceLine(927,0,__PYX_ERR(1, 927, __pyx_L1_error))
19304 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
19314 __Pyx_TraceLine(928,0,__PYX_ERR(1, 928, __pyx_L1_error))
19315 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
19324 __Pyx_TraceLine(929,0,__PYX_ERR(1, 929, __pyx_L1_error))
19325 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
19326 if (unlikely(__pyx_t_2)) {
19335 __Pyx_TraceLine(930,0,__PYX_ERR(1, 930, __pyx_L1_error))
19336 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 930, __pyx_L1_error)
19337 __Pyx_GOTREF(__pyx_t_3);
19338 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 930, __pyx_L1_error)
19339 __Pyx_GOTREF(__pyx_t_4);
19340 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19341 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 930, __pyx_L1_error)
19342 __Pyx_GOTREF(__pyx_t_3);
19343 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19344 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19345 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19346 __PYX_ERR(1, 930, __pyx_L1_error)
19373 __Pyx_TraceLine(932,0,__PYX_ERR(1, 932, __pyx_L1_error))
19374 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
19375 if (unlikely(__pyx_t_2)) {
19384 __Pyx_TraceLine(933,0,__PYX_ERR(1, 933, __pyx_L1_error))
19385 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 933, __pyx_L1_error)
19386 __Pyx_GOTREF(__pyx_t_3);
19387 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 933, __pyx_L1_error)
19388 __Pyx_GOTREF(__pyx_t_4);
19389 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19390 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 933, __pyx_L1_error)
19391 __Pyx_GOTREF(__pyx_t_3);
19392 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19393 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19394 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19395 __PYX_ERR(1, 933, __pyx_L1_error)
19413 __Pyx_TraceLine(935,0,__PYX_ERR(1, 935, __pyx_L1_error))
19414 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
19423 __Pyx_TraceLine(936,0,__PYX_ERR(1, 936, __pyx_L1_error))
19424 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
19434 __Pyx_TraceLine(937,0,__PYX_ERR(1, 937, __pyx_L1_error))
19435 __pyx_v_resultp = ((((
char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
19453 __Pyx_TraceLine(939,0,__PYX_ERR(1, 939, __pyx_L1_error))
19454 __pyx_r = __pyx_v_resultp;
19467 __Pyx_XDECREF(__pyx_t_3);
19468 __Pyx_XDECREF(__pyx_t_4);
19469 __Pyx_AddTraceback(
"View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
19472 __Pyx_TraceReturn(Py_None, 0);
19473 __Pyx_RefNannyFinishContext();
19485 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
19487 Py_ssize_t *__pyx_v_shape;
19488 Py_ssize_t *__pyx_v_strides;
19492 __Pyx_TraceDeclarations
19494 Py_ssize_t *__pyx_t_2;
19497 Py_ssize_t __pyx_t_5;
19498 Py_ssize_t __pyx_t_6;
19502 int __pyx_lineno = 0;
19503 const char *__pyx_filename = NULL;
19504 int __pyx_clineno = 0;
19505 __Pyx_TraceCall(
"transpose_memslice", __pyx_f[1], 945, 1, __PYX_ERR(1, 945, __pyx_L1_error));
19514 __Pyx_TraceLine(946,1,__PYX_ERR(1, 946, __pyx_L1_error))
19515 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
19516 __pyx_v_ndim = __pyx_t_1;
19525 __Pyx_TraceLine(948,1,__PYX_ERR(1, 948, __pyx_L1_error))
19526 __pyx_t_2 = __pyx_v_memslice->shape;
19527 __pyx_v_shape = __pyx_t_2;
19536 __Pyx_TraceLine(949,1,__PYX_ERR(1, 949, __pyx_L1_error))
19537 __pyx_t_2 = __pyx_v_memslice->strides;
19538 __pyx_v_strides = __pyx_t_2;
19547 __Pyx_TraceLine(953,1,__PYX_ERR(1, 953, __pyx_L1_error))
19548 __pyx_t_3 = (__pyx_v_ndim / 2);
19549 __pyx_t_4 = __pyx_t_3;
19550 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
19551 __pyx_v_i = __pyx_t_1;
19560 __Pyx_TraceLine(954,1,__PYX_ERR(1, 954, __pyx_L1_error))
19561 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
19570 __Pyx_TraceLine(955,1,__PYX_ERR(1, 955, __pyx_L1_error))
19571 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
19572 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
19573 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
19574 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
19583 __Pyx_TraceLine(956,1,__PYX_ERR(1, 956, __pyx_L1_error))
19584 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
19585 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
19586 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
19587 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
19596 __Pyx_TraceLine(958,1,__PYX_ERR(1, 958, __pyx_L1_error))
19597 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
19600 __pyx_t_7 = __pyx_t_8;
19601 goto __pyx_L6_bool_binop_done;
19603 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
19604 __pyx_t_7 = __pyx_t_8;
19605 __pyx_L6_bool_binop_done:;
19615 __Pyx_TraceLine(959,1,__PYX_ERR(1, 959, __pyx_L1_error))
19616 __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((
char *)
"Cannot transpose memoryview with indirect dimensions"));
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 959, __pyx_L1_error)
19635 __Pyx_TraceLine(961,1,__PYX_ERR(1, 961, __pyx_L1_error))
19651 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19653 __Pyx_AddTraceback(
"View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
19655 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19660 __Pyx_TraceReturn(Py_None, 1);
19673 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self);
19674 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
19675 __Pyx_RefNannyDeclarations
19676 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
19677 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
19680 __Pyx_RefNannyFinishContext();
19683 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
19684 __Pyx_TraceDeclarations
19685 __Pyx_RefNannyDeclarations
19686 int __pyx_lineno = 0;
19687 const char *__pyx_filename = NULL;
19688 int __pyx_clineno = 0;
19689 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
19690 __Pyx_TraceCall(
"__dealloc__", __pyx_f[1], 978, 0, __PYX_ERR(1, 978, __pyx_L1_error));
19699 __Pyx_TraceLine(979,0,__PYX_ERR(1, 979, __pyx_L1_error))
19700 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
19713 __Pyx_WriteUnraisable(
"View.MemoryView._memoryviewslice.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
19715 __Pyx_TraceReturn(Py_None, 0);
19716 __Pyx_RefNannyFinishContext();
19727 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp) {
19728 PyObject *__pyx_r = NULL;
19729 __Pyx_TraceDeclarations
19730 __Pyx_RefNannyDeclarations
19732 PyObject *__pyx_t_2 = NULL;
19733 int __pyx_lineno = 0;
19734 const char *__pyx_filename = NULL;
19735 int __pyx_clineno = 0;
19736 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
19737 __Pyx_TraceCall(
"convert_item_to_object", __pyx_f[1], 981, 0, __PYX_ERR(1, 981, __pyx_L1_error));
19746 __Pyx_TraceLine(982,0,__PYX_ERR(1, 982, __pyx_L1_error))
19747 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
19757 __Pyx_TraceLine(983,0,__PYX_ERR(1, 983, __pyx_L1_error))
19758 __Pyx_XDECREF(__pyx_r);
19759 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
19760 __Pyx_GOTREF(__pyx_t_2);
19761 __pyx_r = __pyx_t_2;
19781 __Pyx_TraceLine(985,0,__PYX_ERR(1, 985, __pyx_L1_error))
19783 __Pyx_XDECREF(__pyx_r);
19784 __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 985, __pyx_L1_error)
19785 __Pyx_GOTREF(__pyx_t_2);
19786 __pyx_r = __pyx_t_2;
19801 __Pyx_XDECREF(__pyx_t_2);
19802 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
19805 __Pyx_XGIVEREF(__pyx_r);
19806 __Pyx_TraceReturn(__pyx_r, 0);
19807 __Pyx_RefNannyFinishContext();
19819 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
19820 PyObject *__pyx_r = NULL;
19821 __Pyx_TraceDeclarations
19822 __Pyx_RefNannyDeclarations
19825 PyObject *__pyx_t_3 = NULL;
19826 int __pyx_lineno = 0;
19827 const char *__pyx_filename = NULL;
19828 int __pyx_clineno = 0;
19829 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
19830 __Pyx_TraceCall(
"assign_item_from_object", __pyx_f[1], 987, 0, __PYX_ERR(1, 987, __pyx_L1_error));
19839 __Pyx_TraceLine(988,0,__PYX_ERR(1, 988, __pyx_L1_error))
19840 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
19850 __Pyx_TraceLine(989,0,__PYX_ERR(1, 989, __pyx_L1_error))
19851 __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value);
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 989, __pyx_L1_error)
19870 __Pyx_TraceLine(991,0,__PYX_ERR(1, 991, __pyx_L1_error))
19872 __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 991, __pyx_L1_error)
19873 __Pyx_GOTREF(__pyx_t_3);
19874 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19887 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19890 __Pyx_XDECREF(__pyx_t_3);
19891 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
19894 __Pyx_XGIVEREF(__pyx_r);
19895 __Pyx_TraceReturn(__pyx_r, 0);
19896 __Pyx_RefNannyFinishContext();
19909 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self);
19910 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
19911 PyObject *__pyx_r = 0;
19912 __Pyx_RefNannyDeclarations
19913 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
19914 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
19917 __Pyx_RefNannyFinishContext();
19921 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
19922 PyObject *__pyx_r = NULL;
19923 __Pyx_TraceDeclarations
19924 __Pyx_RefNannyDeclarations
19925 int __pyx_lineno = 0;
19926 const char *__pyx_filename = NULL;
19927 int __pyx_clineno = 0;
19928 __Pyx_RefNannySetupContext(
"__get__", 0);
19929 __Pyx_TraceCall(
"__get__", __pyx_f[1], 994, 0, __PYX_ERR(1, 994, __pyx_L1_error));
19938 __Pyx_TraceLine(995,0,__PYX_ERR(1, 995, __pyx_L1_error))
19939 __Pyx_XDECREF(__pyx_r);
19940 __Pyx_INCREF(__pyx_v_self->from_object);
19941 __pyx_r = __pyx_v_self->from_object;
19954 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19957 __Pyx_XGIVEREF(__pyx_r);
19958 __Pyx_TraceReturn(__pyx_r, 0);
19959 __Pyx_RefNannyFinishContext();
19970 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
19971 static PyMethodDef __pyx_mdef___pyx_memoryviewslice_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0};
19972 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
19973 PyObject *__pyx_r = 0;
19974 __Pyx_RefNannyDeclarations
19975 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
19976 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
19979 __Pyx_RefNannyFinishContext();
19983 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
19984 PyObject *__pyx_r = NULL;
19985 __Pyx_TraceDeclarations
19986 __Pyx_RefNannyDeclarations
19987 PyObject *__pyx_t_1 = NULL;
19988 int __pyx_lineno = 0;
19989 const char *__pyx_filename = NULL;
19990 int __pyx_clineno = 0;
19991 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
19992 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
20000 __Pyx_TraceLine(2,0,__PYX_ERR(1, 2, __pyx_L1_error))
20001 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
20002 __Pyx_GOTREF(__pyx_t_1);
20003 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
20004 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20005 __PYX_ERR(1, 2, __pyx_L1_error)
20015 __Pyx_XDECREF(__pyx_t_1);
20016 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20018 __Pyx_XGIVEREF(__pyx_r);
20019 __Pyx_TraceReturn(__pyx_r, 0);
20020 __Pyx_RefNannyFinishContext();
20032 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
20033 static PyMethodDef __pyx_mdef___pyx_memoryviewslice_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0};
20034 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
20035 PyObject *__pyx_r = 0;
20036 __Pyx_RefNannyDeclarations
20037 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
20038 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
20041 __Pyx_RefNannyFinishContext();
20045 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
20046 PyObject *__pyx_r = NULL;
20047 __Pyx_TraceDeclarations
20048 __Pyx_RefNannyDeclarations
20049 PyObject *__pyx_t_1 = NULL;
20050 int __pyx_lineno = 0;
20051 const char *__pyx_filename = NULL;
20052 int __pyx_clineno = 0;
20053 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
20054 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
20061 __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
20062 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
20063 __Pyx_GOTREF(__pyx_t_1);
20064 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
20065 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20066 __PYX_ERR(1, 4, __pyx_L1_error)
20077 __Pyx_XDECREF(__pyx_t_1);
20078 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20080 __Pyx_XGIVEREF(__pyx_r);
20081 __Pyx_TraceReturn(__pyx_r, 0);
20082 __Pyx_RefNannyFinishContext();
20094 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,
int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(
char *),
int (*__pyx_v_to_dtype_func)(
char *, PyObject *),
int __pyx_v_dtype_is_object) {
20095 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
20096 Py_ssize_t __pyx_v_suboffset;
20097 PyObject *__pyx_v_length = NULL;
20098 PyObject *__pyx_r = NULL;
20099 __Pyx_TraceDeclarations
20100 __Pyx_RefNannyDeclarations
20102 PyObject *__pyx_t_2 = NULL;
20103 PyObject *__pyx_t_3 = NULL;
20104 __Pyx_TypeInfo *__pyx_t_4;
20105 Py_buffer __pyx_t_5;
20106 Py_ssize_t *__pyx_t_6;
20107 Py_ssize_t *__pyx_t_7;
20108 Py_ssize_t *__pyx_t_8;
20109 Py_ssize_t __pyx_t_9;
20110 int __pyx_lineno = 0;
20111 const char *__pyx_filename = NULL;
20112 int __pyx_clineno = 0;
20113 __Pyx_RefNannySetupContext(
"memoryview_fromslice", 0);
20114 __Pyx_TraceCall(
"memoryview_fromslice", __pyx_f[1], 1001, 0, __PYX_ERR(1, 1001, __pyx_L1_error));
20123 __Pyx_TraceLine(1009,0,__PYX_ERR(1, 1009, __pyx_L1_error))
20124 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
20134 __Pyx_TraceLine(1010,0,__PYX_ERR(1, 1010, __pyx_L1_error))
20135 __Pyx_XDECREF(__pyx_r);
20136 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20155 __Pyx_TraceLine(1015,0,__PYX_ERR(1, 1015, __pyx_L1_error))
20156 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1015, __pyx_L1_error)
20157 __Pyx_GOTREF(__pyx_t_2);
20158 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1015, __pyx_L1_error)
20159 __Pyx_GOTREF(__pyx_t_3);
20160 __Pyx_INCREF(Py_None);
20161 __Pyx_GIVEREF(Py_None);
20162 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
20163 __Pyx_INCREF(__pyx_int_0);
20164 __Pyx_GIVEREF(__pyx_int_0);
20165 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
20166 __Pyx_GIVEREF(__pyx_t_2);
20167 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
20169 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1015, __pyx_L1_error)
20170 __Pyx_GOTREF(__pyx_t_2);
20171 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20172 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_2);
20182 __Pyx_TraceLine(1017,0,__PYX_ERR(1, 1017, __pyx_L1_error))
20183 __pyx_v_result->from_slice = __pyx_v_memviewslice;
20192 __Pyx_TraceLine(1018,0,__PYX_ERR(1, 1018, __pyx_L1_error))
20193 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
20202 __Pyx_TraceLine(1020,0,__PYX_ERR(1, 1020, __pyx_L1_error))
20203 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1020, __pyx_L1_error)
20204 __Pyx_GOTREF(__pyx_t_2);
20205 __Pyx_GIVEREF(__pyx_t_2);
20206 __Pyx_GOTREF(__pyx_v_result->from_object);
20207 __Pyx_DECREF(__pyx_v_result->from_object);
20208 __pyx_v_result->from_object = __pyx_t_2;
20218 __Pyx_TraceLine(1021,0,__PYX_ERR(1, 1021, __pyx_L1_error))
20219 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
20220 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
20229 __Pyx_TraceLine(1023,0,__PYX_ERR(1, 1023, __pyx_L1_error))
20230 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
20231 __pyx_v_result->__pyx_base.view = __pyx_t_5;
20240 __Pyx_TraceLine(1024,0,__PYX_ERR(1, 1024, __pyx_L1_error))
20241 __pyx_v_result->__pyx_base.view.buf = ((
void *)__pyx_v_memviewslice.data);
20250 __Pyx_TraceLine(1025,0,__PYX_ERR(1, 1025, __pyx_L1_error))
20251 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
20260 __Pyx_TraceLine(1026,0,__PYX_ERR(1, 1026, __pyx_L1_error))
20261 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
20270 __Pyx_TraceLine(1027,0,__PYX_ERR(1, 1027, __pyx_L1_error))
20271 Py_INCREF(Py_None);
20280 __Pyx_TraceLine(1029,0,__PYX_ERR(1, 1029, __pyx_L1_error))
20281 __pyx_t_1 = ((((
struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
20291 __Pyx_TraceLine(1030,0,__PYX_ERR(1, 1030, __pyx_L1_error))
20292 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
20311 __Pyx_TraceLine(1032,0,__PYX_ERR(1, 1032, __pyx_L1_error))
20313 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
20324 __Pyx_TraceLine(1034,0,__PYX_ERR(1, 1034, __pyx_L1_error))
20325 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
20334 __Pyx_TraceLine(1035,0,__PYX_ERR(1, 1035, __pyx_L1_error))
20335 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
20344 __Pyx_TraceLine(1038,0,__PYX_ERR(1, 1038, __pyx_L1_error))
20345 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
20354 __Pyx_TraceLine(1039,0,__PYX_ERR(1, 1039, __pyx_L1_error))
20355 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
20356 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
20357 __pyx_t_6 = __pyx_t_8;
20358 __pyx_v_suboffset = (__pyx_t_6[0]);
20367 __Pyx_TraceLine(1040,0,__PYX_ERR(1, 1040, __pyx_L1_error))
20368 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
20378 __Pyx_TraceLine(1041,0,__PYX_ERR(1, 1041, __pyx_L1_error))
20379 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
20388 __Pyx_TraceLine(1042,0,__PYX_ERR(1, 1042, __pyx_L1_error))
20389 goto __pyx_L6_break;
20409 __Pyx_TraceLine(1044,0,__PYX_ERR(1, 1044, __pyx_L1_error))
20410 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
20411 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
20420 __Pyx_TraceLine(1045,0,__PYX_ERR(1, 1045, __pyx_L1_error))
20421 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
20422 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
20423 __pyx_t_6 = __pyx_t_8;
20424 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0]));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error)
20425 __Pyx_GOTREF(__pyx_t_2);
20426 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
20436 __Pyx_TraceLine(1046,0,__PYX_ERR(1, 1046, __pyx_L1_error))
20437 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1046, __pyx_L1_error)
20438 __Pyx_GOTREF(__pyx_t_2);
20439 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1046, __pyx_L1_error)
20440 __Pyx_GOTREF(__pyx_t_3);
20441 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20442 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1046, __pyx_L1_error)
20443 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20444 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
20454 __Pyx_TraceLine(1048,0,__PYX_ERR(1, 1048, __pyx_L1_error))
20455 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
20464 __Pyx_TraceLine(1049,0,__PYX_ERR(1, 1049, __pyx_L1_error))
20465 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
20474 __Pyx_TraceLine(1051,0,__PYX_ERR(1, 1051, __pyx_L1_error))
20475 __Pyx_XDECREF(__pyx_r);
20476 __Pyx_INCREF(((PyObject *)__pyx_v_result));
20477 __pyx_r = ((PyObject *)__pyx_v_result);
20490 __Pyx_XDECREF(__pyx_t_2);
20491 __Pyx_XDECREF(__pyx_t_3);
20492 __Pyx_AddTraceback(
"View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
20495 __Pyx_XDECREF((PyObject *)__pyx_v_result);
20496 __Pyx_XDECREF(__pyx_v_length);
20497 __Pyx_XGIVEREF(__pyx_r);
20498 __Pyx_TraceReturn(__pyx_r, 0);
20499 __Pyx_RefNannyFinishContext();
20511 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
20512 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
20513 __Pyx_memviewslice *__pyx_r;
20514 __Pyx_TraceDeclarations
20515 __Pyx_RefNannyDeclarations
20518 PyObject *__pyx_t_3 = NULL;
20519 int __pyx_lineno = 0;
20520 const char *__pyx_filename = NULL;
20521 int __pyx_clineno = 0;
20522 __Pyx_RefNannySetupContext(
"get_slice_from_memview", 0);
20523 __Pyx_TraceCall(
"get_slice_from_memview", __pyx_f[1], 1054, 0, __PYX_ERR(1, 1054, __pyx_L1_error));
20532 __Pyx_TraceLine(1057,0,__PYX_ERR(1, 1057, __pyx_L1_error))
20533 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
20534 __pyx_t_2 = (__pyx_t_1 != 0);
20544 __Pyx_TraceLine(1058,0,__PYX_ERR(1, 1058, __pyx_L1_error))
20545 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1058, __pyx_L1_error)
20546 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
20547 __Pyx_INCREF(__pyx_t_3);
20548 __pyx_v_obj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
20558 __Pyx_TraceLine(1059,0,__PYX_ERR(1, 1059, __pyx_L1_error))
20559 __pyx_r = (&__pyx_v_obj->from_slice);
20578 __Pyx_TraceLine(1061,0,__PYX_ERR(1, 1061, __pyx_L1_error))
20580 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
20589 __Pyx_TraceLine(1062,0,__PYX_ERR(1, 1062, __pyx_L1_error))
20590 __pyx_r = __pyx_v_mslice;
20604 __Pyx_XDECREF(__pyx_t_3);
20605 __Pyx_AddTraceback(
"View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
20608 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
20609 __Pyx_TraceReturn(Py_None, 0);
20610 __Pyx_RefNannyFinishContext();
20622 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
20624 Py_ssize_t *__pyx_v_shape;
20625 Py_ssize_t *__pyx_v_strides;
20626 Py_ssize_t *__pyx_v_suboffsets;
20627 __Pyx_TraceDeclarations
20628 __Pyx_RefNannyDeclarations
20629 Py_ssize_t *__pyx_t_1;
20633 Py_ssize_t __pyx_t_5;
20634 int __pyx_lineno = 0;
20635 const char *__pyx_filename = NULL;
20636 int __pyx_clineno = 0;
20637 __Pyx_RefNannySetupContext(
"slice_copy", 0);
20638 __Pyx_TraceCall(
"slice_copy", __pyx_f[1], 1065, 0, __PYX_ERR(1, 1065, __pyx_L1_error));
20647 __Pyx_TraceLine(1069,0,__PYX_ERR(1, 1069, __pyx_L1_error))
20648 __pyx_t_1 = __pyx_v_memview->view.shape;
20649 __pyx_v_shape = __pyx_t_1;
20658 __Pyx_TraceLine(1070,0,__PYX_ERR(1, 1070, __pyx_L1_error))
20659 __pyx_t_1 = __pyx_v_memview->view.strides;
20660 __pyx_v_strides = __pyx_t_1;
20669 __Pyx_TraceLine(1071,0,__PYX_ERR(1, 1071, __pyx_L1_error))
20670 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
20671 __pyx_v_suboffsets = __pyx_t_1;
20680 __Pyx_TraceLine(1073,0,__PYX_ERR(1, 1073, __pyx_L1_error))
20681 __pyx_v_dst->memview = ((
struct __pyx_memoryview_obj *)__pyx_v_memview);
20690 __Pyx_TraceLine(1074,0,__PYX_ERR(1, 1074, __pyx_L1_error))
20691 __pyx_v_dst->data = ((
char *)__pyx_v_memview->view.buf);
20700 __Pyx_TraceLine(1076,0,__PYX_ERR(1, 1076, __pyx_L1_error))
20701 __pyx_t_2 = __pyx_v_memview->view.ndim;
20702 __pyx_t_3 = __pyx_t_2;
20703 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20704 __pyx_v_dim = __pyx_t_4;
20713 __Pyx_TraceLine(1077,0,__PYX_ERR(1, 1077, __pyx_L1_error))
20714 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
20723 __Pyx_TraceLine(1078,0,__PYX_ERR(1, 1078, __pyx_L1_error))
20724 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
20733 __Pyx_TraceLine(1079,0,__PYX_ERR(1, 1079, __pyx_L1_error))
20734 if ((__pyx_v_suboffsets != 0)) {
20735 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
20739 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
20753 __Pyx_WriteUnraisable(
"View.MemoryView.slice_copy", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
20755 __Pyx_TraceReturn(Py_None, 0);
20756 __Pyx_RefNannyFinishContext();
20767 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *__pyx_v_memview) {
20768 __Pyx_memviewslice __pyx_v_memviewslice;
20769 PyObject *__pyx_r = NULL;
20770 __Pyx_TraceDeclarations
20771 __Pyx_RefNannyDeclarations
20772 PyObject *__pyx_t_1 = NULL;
20773 int __pyx_lineno = 0;
20774 const char *__pyx_filename = NULL;
20775 int __pyx_clineno = 0;
20776 __Pyx_RefNannySetupContext(
"memoryview_copy", 0);
20777 __Pyx_TraceCall(
"memoryview_copy", __pyx_f[1], 1082, 0, __PYX_ERR(1, 1082, __pyx_L1_error));
20786 __Pyx_TraceLine(1085,0,__PYX_ERR(1, 1085, __pyx_L1_error))
20787 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
20796 __Pyx_TraceLine(1086,0,__PYX_ERR(1, 1086, __pyx_L1_error))
20797 __Pyx_XDECREF(__pyx_r);
20798 __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1086, __pyx_L1_error)
20799 __Pyx_GOTREF(__pyx_t_1);
20800 __pyx_r = __pyx_t_1;
20814 __Pyx_XDECREF(__pyx_t_1);
20815 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
20818 __Pyx_XGIVEREF(__pyx_r);
20819 __Pyx_TraceReturn(__pyx_r, 0);
20820 __Pyx_RefNannyFinishContext();
20832 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
20833 PyObject *(*__pyx_v_to_object_func)(
char *);
20834 int (*__pyx_v_to_dtype_func)(
char *, PyObject *);
20835 PyObject *__pyx_r = NULL;
20836 __Pyx_TraceDeclarations
20837 __Pyx_RefNannyDeclarations
20840 PyObject *(*__pyx_t_3)(
char *);
20841 int (*__pyx_t_4)(
char *, PyObject *);
20842 PyObject *__pyx_t_5 = NULL;
20843 int __pyx_lineno = 0;
20844 const char *__pyx_filename = NULL;
20845 int __pyx_clineno = 0;
20846 __Pyx_RefNannySetupContext(
"memoryview_copy_from_slice", 0);
20847 __Pyx_TraceCall(
"memoryview_copy_from_slice", __pyx_f[1], 1089, 0, __PYX_ERR(1, 1089, __pyx_L1_error));
20856 __Pyx_TraceLine(1096,0,__PYX_ERR(1, 1096, __pyx_L1_error))
20857 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
20858 __pyx_t_2 = (__pyx_t_1 != 0);
20868 __Pyx_TraceLine(1097,0,__PYX_ERR(1, 1097, __pyx_L1_error))
20869 __pyx_t_3 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
20870 __pyx_v_to_object_func = __pyx_t_3;
20879 __Pyx_TraceLine(1098,0,__PYX_ERR(1, 1098, __pyx_L1_error))
20880 __pyx_t_4 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
20881 __pyx_v_to_dtype_func = __pyx_t_4;
20900 __Pyx_TraceLine(1100,0,__PYX_ERR(1, 1100, __pyx_L1_error))
20902 __pyx_v_to_object_func = NULL;
20911 __Pyx_TraceLine(1101,0,__PYX_ERR(1, 1101, __pyx_L1_error))
20912 __pyx_v_to_dtype_func = NULL;
20923 __Pyx_TraceLine(1103,0,__PYX_ERR(1, 1103, __pyx_L1_error))
20924 __Pyx_XDECREF(__pyx_r);
20933 __Pyx_TraceLine(1105,0,__PYX_ERR(1, 1105, __pyx_L1_error))
20934 __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1103, __pyx_L1_error)
20935 __Pyx_GOTREF(__pyx_t_5);
20936 __pyx_r = __pyx_t_5;
20950 __Pyx_XDECREF(__pyx_t_5);
20951 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
20954 __Pyx_XGIVEREF(__pyx_r);
20955 __Pyx_TraceReturn(__pyx_r, 0);
20956 __Pyx_RefNannyFinishContext();
20968 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
20969 Py_ssize_t __pyx_r;
20970 __Pyx_TraceDeclarations
20972 int __pyx_lineno = 0;
20973 const char *__pyx_filename = NULL;
20974 int __pyx_clineno = 0;
20975 __Pyx_TraceCall(
"abs_py_ssize_t", __pyx_f[1], 1111, 1, __PYX_ERR(1, 1111, __pyx_L1_error));
20984 __Pyx_TraceLine(1112,1,__PYX_ERR(1, 1112, __pyx_L1_error))
20985 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
20995 __Pyx_TraceLine(1113,1,__PYX_ERR(1, 1113, __pyx_L1_error))
20996 __pyx_r = (-__pyx_v_arg);
21015 __Pyx_TraceLine(1115,1,__PYX_ERR(1, 1115, __pyx_L1_error))
21017 __pyx_r = __pyx_v_arg;
21031 __Pyx_WriteUnraisable(
"View.MemoryView.abs_py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21034 __Pyx_TraceReturn(Py_None, 1);
21046 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim) {
21048 Py_ssize_t __pyx_v_c_stride;
21049 Py_ssize_t __pyx_v_f_stride;
21051 __Pyx_TraceDeclarations
21056 int __pyx_lineno = 0;
21057 const char *__pyx_filename = NULL;
21058 int __pyx_clineno = 0;
21059 __Pyx_TraceCall(
"get_best_order", __pyx_f[1], 1118, 1, __PYX_ERR(1, 1118, __pyx_L1_error));
21068 __Pyx_TraceLine(1123,1,__PYX_ERR(1, 1123, __pyx_L1_error))
21069 __pyx_v_c_stride = 0;
21078 __Pyx_TraceLine(1124,1,__PYX_ERR(1, 1124, __pyx_L1_error))
21079 __pyx_v_f_stride = 0;
21088 __Pyx_TraceLine(1126,1,__PYX_ERR(1, 1126, __pyx_L1_error))
21089 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
21090 __pyx_v_i = __pyx_t_1;
21099 __Pyx_TraceLine(1127,1,__PYX_ERR(1, 1127, __pyx_L1_error))
21100 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
21110 __Pyx_TraceLine(1128,1,__PYX_ERR(1, 1128, __pyx_L1_error))
21111 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
21120 __Pyx_TraceLine(1129,1,__PYX_ERR(1, 1129, __pyx_L1_error))
21121 goto __pyx_L4_break;
21141 __Pyx_TraceLine(1131,1,__PYX_ERR(1, 1131, __pyx_L1_error))
21142 __pyx_t_1 = __pyx_v_ndim;
21143 __pyx_t_3 = __pyx_t_1;
21144 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
21145 __pyx_v_i = __pyx_t_4;
21154 __Pyx_TraceLine(1132,1,__PYX_ERR(1, 1132, __pyx_L1_error))
21155 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
21165 __Pyx_TraceLine(1133,1,__PYX_ERR(1, 1133, __pyx_L1_error))
21166 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
21175 __Pyx_TraceLine(1134,1,__PYX_ERR(1, 1134, __pyx_L1_error))
21176 goto __pyx_L7_break;
21196 __Pyx_TraceLine(1136,1,__PYX_ERR(1, 1136, __pyx_L1_error))
21197 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
21207 __Pyx_TraceLine(1137,1,__PYX_ERR(1, 1137, __pyx_L1_error))
21227 __Pyx_TraceLine(1139,1,__PYX_ERR(1, 1139, __pyx_L1_error))
21243 __Pyx_WriteUnraisable(
"View.MemoryView.get_best_order", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21246 __Pyx_TraceReturn(Py_None, 1);
21258 static void _copy_strided_to_strided(
char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides,
char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
21259 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
21260 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
21261 Py_ssize_t __pyx_v_dst_extent;
21262 Py_ssize_t __pyx_v_src_stride;
21263 Py_ssize_t __pyx_v_dst_stride;
21267 Py_ssize_t __pyx_t_4;
21268 Py_ssize_t __pyx_t_5;
21269 Py_ssize_t __pyx_t_6;
21278 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
21287 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
21296 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
21305 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
21314 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
21324 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
21327 __pyx_t_1 = __pyx_t_2;
21328 goto __pyx_L5_bool_binop_done;
21330 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
21333 __pyx_t_1 = __pyx_t_2;
21334 goto __pyx_L5_bool_binop_done;
21344 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
21346 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
21348 __pyx_t_3 = (__pyx_t_2 != 0);
21349 __pyx_t_1 = __pyx_t_3;
21350 __pyx_L5_bool_binop_done:;
21368 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
21388 __pyx_t_4 = __pyx_v_dst_extent;
21389 __pyx_t_5 = __pyx_t_4;
21390 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21391 __pyx_v_i = __pyx_t_6;
21400 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
21409 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
21418 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
21441 __pyx_t_4 = __pyx_v_dst_extent;
21442 __pyx_t_5 = __pyx_t_4;
21443 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21444 __pyx_v_i = __pyx_t_6;
21453 _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
21462 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
21471 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
21495 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
21496 __Pyx_TraceDeclarations
21497 int __pyx_lineno = 0;
21498 const char *__pyx_filename = NULL;
21499 int __pyx_clineno = 0;
21500 __Pyx_TraceCall(
"copy_strided_to_strided", __pyx_f[1], 1172, 1, __PYX_ERR(1, 1172, __pyx_L1_error));
21509 __Pyx_TraceLine(1175,1,__PYX_ERR(1, 1175, __pyx_L1_error))
21510 _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
21523 __Pyx_WriteUnraisable(
"View.MemoryView.copy_strided_to_strided", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21525 __Pyx_TraceReturn(Py_None, 1);
21536 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src,
int __pyx_v_ndim) {
21537 Py_ssize_t __pyx_v_shape;
21538 Py_ssize_t __pyx_v_size;
21539 Py_ssize_t __pyx_r;
21540 __Pyx_TraceDeclarations
21541 Py_ssize_t __pyx_t_1;
21542 Py_ssize_t *__pyx_t_2;
21543 Py_ssize_t *__pyx_t_3;
21544 Py_ssize_t *__pyx_t_4;
21545 int __pyx_lineno = 0;
21546 const char *__pyx_filename = NULL;
21547 int __pyx_clineno = 0;
21548 __Pyx_TraceCall(
"slice_get_size", __pyx_f[1], 1179, 1, __PYX_ERR(1, 1179, __pyx_L1_error));
21557 __Pyx_TraceLine(1181,1,__PYX_ERR(1, 1181, __pyx_L1_error))
21558 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
21559 __pyx_v_size = __pyx_t_1;
21568 __Pyx_TraceLine(1183,1,__PYX_ERR(1, 1183, __pyx_L1_error))
21569 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
21570 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
21571 __pyx_t_2 = __pyx_t_4;
21572 __pyx_v_shape = (__pyx_t_2[0]);
21581 __Pyx_TraceLine(1184,1,__PYX_ERR(1, 1184, __pyx_L1_error))
21582 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
21592 __Pyx_TraceLine(1186,1,__PYX_ERR(1, 1186, __pyx_L1_error))
21593 __pyx_r = __pyx_v_size;
21606 __Pyx_WriteUnraisable(
"View.MemoryView.slice_get_size", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21609 __Pyx_TraceReturn(Py_None, 1);
21621 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride,
int __pyx_v_ndim,
char __pyx_v_order) {
21623 Py_ssize_t __pyx_r;
21624 __Pyx_TraceDeclarations
21629 int __pyx_lineno = 0;
21630 const char *__pyx_filename = NULL;
21631 int __pyx_clineno = 0;
21632 __Pyx_TraceCall(
"fill_contig_strides_array", __pyx_f[1], 1189, 1, __PYX_ERR(1, 1189, __pyx_L1_error));
21641 __Pyx_TraceLine(1198,1,__PYX_ERR(1, 1198, __pyx_L1_error))
21642 __pyx_t_1 = ((__pyx_v_order ==
'F') != 0);
21652 __Pyx_TraceLine(1199,1,__PYX_ERR(1, 1199, __pyx_L1_error))
21653 __pyx_t_2 = __pyx_v_ndim;
21654 __pyx_t_3 = __pyx_t_2;
21655 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
21656 __pyx_v_idx = __pyx_t_4;
21665 __Pyx_TraceLine(1200,1,__PYX_ERR(1, 1200, __pyx_L1_error))
21666 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
21675 __Pyx_TraceLine(1201,1,__PYX_ERR(1, 1201, __pyx_L1_error))
21676 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
21696 __Pyx_TraceLine(1203,1,__PYX_ERR(1, 1203, __pyx_L1_error))
21698 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
21699 __pyx_v_idx = __pyx_t_2;
21708 __Pyx_TraceLine(1204,1,__PYX_ERR(1, 1204, __pyx_L1_error))
21709 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
21718 __Pyx_TraceLine(1205,1,__PYX_ERR(1, 1205, __pyx_L1_error))
21719 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
21731 __Pyx_TraceLine(1207,1,__PYX_ERR(1, 1207, __pyx_L1_error))
21732 __pyx_r = __pyx_v_stride;
21745 __Pyx_WriteUnraisable(
"View.MemoryView.fill_contig_strides_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21748 __Pyx_TraceReturn(Py_None, 1);
21760 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice,
char __pyx_v_order,
int __pyx_v_ndim) {
21762 void *__pyx_v_result;
21763 size_t __pyx_v_itemsize;
21764 size_t __pyx_v_size;
21766 __Pyx_TraceDeclarations
21767 Py_ssize_t __pyx_t_1;
21770 struct __pyx_memoryview_obj *__pyx_t_4;
21773 int __pyx_lineno = 0;
21774 const char *__pyx_filename = NULL;
21775 int __pyx_clineno = 0;
21776 __Pyx_TraceCall(
"copy_data_to_temp", __pyx_f[1], 1210, 1, __PYX_ERR(1, 1210, __pyx_L1_error));
21785 __Pyx_TraceLine(1221,1,__PYX_ERR(1, 1221, __pyx_L1_error))
21786 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
21787 __pyx_v_itemsize = __pyx_t_1;
21796 __Pyx_TraceLine(1222,1,__PYX_ERR(1, 1222, __pyx_L1_error))
21797 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
21806 __Pyx_TraceLine(1224,1,__PYX_ERR(1, 1224, __pyx_L1_error))
21807 __pyx_v_result = malloc(__pyx_v_size);
21816 __Pyx_TraceLine(1225,1,__PYX_ERR(1, 1225, __pyx_L1_error))
21817 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
21827 __Pyx_TraceLine(1226,1,__PYX_ERR(1, 1226, __pyx_L1_error))
21828 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 1226, __pyx_L1_error)
21846 __Pyx_TraceLine(1229,1,__PYX_ERR(1, 1229, __pyx_L1_error))
21847 __pyx_v_tmpslice->data = ((
char *)__pyx_v_result);
21856 __Pyx_TraceLine(1230,1,__PYX_ERR(1, 1230, __pyx_L1_error))
21857 __pyx_t_4 = __pyx_v_src->memview;
21858 __pyx_v_tmpslice->memview = __pyx_t_4;
21867 __Pyx_TraceLine(1231,1,__PYX_ERR(1, 1231, __pyx_L1_error))
21868 __pyx_t_3 = __pyx_v_ndim;
21869 __pyx_t_5 = __pyx_t_3;
21870 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21871 __pyx_v_i = __pyx_t_6;
21880 __Pyx_TraceLine(1232,1,__PYX_ERR(1, 1232, __pyx_L1_error))
21881 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
21890 __Pyx_TraceLine(1233,1,__PYX_ERR(1, 1233, __pyx_L1_error))
21891 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
21901 __Pyx_TraceLine(1235,1,__PYX_ERR(1, 1235, __pyx_L1_error))
21902 (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
21911 __Pyx_TraceLine(1239,1,__PYX_ERR(1, 1239, __pyx_L1_error))
21912 __pyx_t_3 = __pyx_v_ndim;
21913 __pyx_t_5 = __pyx_t_3;
21914 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21915 __pyx_v_i = __pyx_t_6;
21924 __Pyx_TraceLine(1240,1,__PYX_ERR(1, 1240, __pyx_L1_error))
21925 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
21935 __Pyx_TraceLine(1241,1,__PYX_ERR(1, 1241, __pyx_L1_error))
21936 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
21955 __Pyx_TraceLine(1243,1,__PYX_ERR(1, 1243, __pyx_L1_error))
21956 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
21966 __Pyx_TraceLine(1244,1,__PYX_ERR(1, 1244, __pyx_L1_error))
21967 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
21986 __Pyx_TraceLine(1246,1,__PYX_ERR(1, 1246, __pyx_L1_error))
21988 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
21999 __Pyx_TraceLine(1248,1,__PYX_ERR(1, 1248, __pyx_L1_error))
22000 __pyx_r = __pyx_v_result;
22015 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22017 __Pyx_AddTraceback(
"View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
22019 __Pyx_PyGILState_Release(__pyx_gilstate_save);
22024 __Pyx_TraceReturn(Py_None, 1);
22036 static int __pyx_memoryview_err_extents(
int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
22038 __Pyx_TraceDeclarations
22039 __Pyx_RefNannyDeclarations
22040 PyObject *__pyx_t_1 = NULL;
22041 PyObject *__pyx_t_2 = NULL;
22042 PyObject *__pyx_t_3 = NULL;
22043 PyObject *__pyx_t_4 = NULL;
22044 int __pyx_lineno = 0;
22045 const char *__pyx_filename = NULL;
22046 int __pyx_clineno = 0;
22048 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22050 __Pyx_RefNannySetupContext(
"_err_extents", 0);
22051 __Pyx_TraceCall(
"_err_extents", __pyx_f[1], 1253, 0, __PYX_ERR(1, 1253, __pyx_L1_error));
22060 __Pyx_TraceLine(1256,0,__PYX_ERR(1, 1256, __pyx_L1_error))
22061 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1256, __pyx_L1_error)
22062 __Pyx_GOTREF(__pyx_t_1);
22063 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1256, __pyx_L1_error)
22064 __Pyx_GOTREF(__pyx_t_2);
22065 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1256, __pyx_L1_error)
22066 __Pyx_GOTREF(__pyx_t_3);
22067 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1256, __pyx_L1_error)
22068 __Pyx_GOTREF(__pyx_t_4);
22069 __Pyx_GIVEREF(__pyx_t_1);
22070 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
22071 __Pyx_GIVEREF(__pyx_t_2);
22072 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
22073 __Pyx_GIVEREF(__pyx_t_3);
22074 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
22086 __Pyx_TraceLine(1255,0,__PYX_ERR(1, 1255, __pyx_L1_error))
22087 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1255, __pyx_L1_error)
22088 __Pyx_GOTREF(__pyx_t_3);
22089 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22090 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1255, __pyx_L1_error)
22091 __Pyx_GOTREF(__pyx_t_4);
22092 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22093 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
22094 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22095 __PYX_ERR(1, 1255, __pyx_L1_error)
22107 __Pyx_XDECREF(__pyx_t_1);
22108 __Pyx_XDECREF(__pyx_t_2);
22109 __Pyx_XDECREF(__pyx_t_3);
22110 __Pyx_XDECREF(__pyx_t_4);
22111 __Pyx_AddTraceback(
"View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
22113 __Pyx_TraceReturn(Py_None, 0);
22114 __Pyx_RefNannyFinishContext();
22116 __Pyx_PyGILState_Release(__pyx_gilstate_save);
22129 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error,
char *__pyx_v_msg,
int __pyx_v_dim) {
22131 __Pyx_TraceDeclarations
22132 __Pyx_RefNannyDeclarations
22133 PyObject *__pyx_t_1 = NULL;
22134 PyObject *__pyx_t_2 = NULL;
22135 PyObject *__pyx_t_3 = NULL;
22136 PyObject *__pyx_t_4 = NULL;
22137 int __pyx_lineno = 0;
22138 const char *__pyx_filename = NULL;
22139 int __pyx_clineno = 0;
22141 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22143 __Pyx_RefNannySetupContext(
"_err_dim", 0);
22144 __Pyx_TraceCall(
"_err_dim", __pyx_f[1], 1259, 0, __PYX_ERR(1, 1259, __pyx_L1_error));
22145 __Pyx_INCREF(__pyx_v_error);
22154 __Pyx_TraceLine(1260,0,__PYX_ERR(1, 1260, __pyx_L1_error))
22155 __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1260, __pyx_L1_error)
22156 __Pyx_GOTREF(__pyx_t_2);
22157 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1260, __pyx_L1_error)
22158 __Pyx_GOTREF(__pyx_t_3);
22159 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1260, __pyx_L1_error)
22160 __Pyx_GOTREF(__pyx_t_4);
22161 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22162 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22163 __Pyx_INCREF(__pyx_v_error);
22164 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
22165 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
22166 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
22167 if (likely(__pyx_t_2)) {
22168 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
22169 __Pyx_INCREF(__pyx_t_2);
22170 __Pyx_INCREF(
function);
22171 __Pyx_DECREF_SET(__pyx_t_3,
function);
22174 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
22175 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22176 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22177 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1260, __pyx_L1_error)
22178 __Pyx_GOTREF(__pyx_t_1);
22179 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22180 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
22181 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22182 __PYX_ERR(1, 1260, __pyx_L1_error)
22194 __Pyx_XDECREF(__pyx_t_1);
22195 __Pyx_XDECREF(__pyx_t_2);
22196 __Pyx_XDECREF(__pyx_t_3);
22197 __Pyx_XDECREF(__pyx_t_4);
22198 __Pyx_AddTraceback(
"View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
22200 __Pyx_XDECREF(__pyx_v_error);
22201 __Pyx_TraceReturn(Py_None, 0);
22202 __Pyx_RefNannyFinishContext();
22204 __Pyx_PyGILState_Release(__pyx_gilstate_save);
22217 static int __pyx_memoryview_err(PyObject *__pyx_v_error,
char *__pyx_v_msg) {
22219 __Pyx_TraceDeclarations
22220 __Pyx_RefNannyDeclarations
22222 PyObject *__pyx_t_2 = NULL;
22223 PyObject *__pyx_t_3 = NULL;
22224 PyObject *__pyx_t_4 = NULL;
22225 PyObject *__pyx_t_5 = NULL;
22226 int __pyx_lineno = 0;
22227 const char *__pyx_filename = NULL;
22228 int __pyx_clineno = 0;
22230 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22232 __Pyx_RefNannySetupContext(
"_err", 0);
22233 __Pyx_TraceCall(
"_err", __pyx_f[1], 1263, 0, __PYX_ERR(1, 1263, __pyx_L1_error));
22234 __Pyx_INCREF(__pyx_v_error);
22243 __Pyx_TraceLine(1264,0,__PYX_ERR(1, 1264, __pyx_L1_error))
22244 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
22245 if (unlikely(__pyx_t_1)) {
22254 __Pyx_TraceLine(1265,0,__PYX_ERR(1, 1265, __pyx_L1_error))
22255 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1265, __pyx_L1_error)
22256 __Pyx_GOTREF(__pyx_t_3);
22257 __Pyx_INCREF(__pyx_v_error);
22258 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
22259 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
22260 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
22261 if (likely(__pyx_t_5)) {
22262 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
22263 __Pyx_INCREF(__pyx_t_5);
22264 __Pyx_INCREF(
function);
22265 __Pyx_DECREF_SET(__pyx_t_4,
function);
22268 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
22269 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
22270 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22271 if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1265, __pyx_L1_error)
22272 __Pyx_GOTREF(__pyx_t_2);
22273 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22274 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
22275 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22276 __PYX_ERR(1, 1265, __pyx_L1_error)
22294 __Pyx_TraceLine(1267,0,__PYX_ERR(1, 1267, __pyx_L1_error))
22296 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
22297 __PYX_ERR(1, 1267, __pyx_L1_error)
22310 __Pyx_XDECREF(__pyx_t_2);
22311 __Pyx_XDECREF(__pyx_t_3);
22312 __Pyx_XDECREF(__pyx_t_4);
22313 __Pyx_XDECREF(__pyx_t_5);
22314 __Pyx_AddTraceback(
"View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
22316 __Pyx_XDECREF(__pyx_v_error);
22317 __Pyx_TraceReturn(Py_None, 0);
22318 __Pyx_RefNannyFinishContext();
22320 __Pyx_PyGILState_Release(__pyx_gilstate_save);
22333 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst,
int __pyx_v_src_ndim,
int __pyx_v_dst_ndim,
int __pyx_v_dtype_is_object) {
22334 void *__pyx_v_tmpdata;
22335 size_t __pyx_v_itemsize;
22337 char __pyx_v_order;
22338 int __pyx_v_broadcasting;
22339 int __pyx_v_direct_copy;
22340 __Pyx_memviewslice __pyx_v_tmp;
22343 __Pyx_TraceDeclarations
22344 Py_ssize_t __pyx_t_1;
22352 int __pyx_lineno = 0;
22353 const char *__pyx_filename = NULL;
22354 int __pyx_clineno = 0;
22355 __Pyx_TraceCall(
"memoryview_copy_contents", __pyx_f[1], 1270, 1, __PYX_ERR(1, 1270, __pyx_L1_error));
22364 __Pyx_TraceLine(1278,1,__PYX_ERR(1, 1278, __pyx_L1_error))
22365 __pyx_v_tmpdata = NULL;
22374 __Pyx_TraceLine(1279,1,__PYX_ERR(1, 1279, __pyx_L1_error))
22375 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
22376 __pyx_v_itemsize = __pyx_t_1;
22385 __Pyx_TraceLine(1281,1,__PYX_ERR(1, 1281, __pyx_L1_error))
22386 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
22395 __Pyx_TraceLine(1282,1,__PYX_ERR(1, 1282, __pyx_L1_error))
22396 __pyx_v_broadcasting = 0;
22405 __Pyx_TraceLine(1283,1,__PYX_ERR(1, 1283, __pyx_L1_error))
22406 __pyx_v_direct_copy = 0;
22415 __Pyx_TraceLine(1286,1,__PYX_ERR(1, 1286, __pyx_L1_error))
22416 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
22426 __Pyx_TraceLine(1287,1,__PYX_ERR(1, 1287, __pyx_L1_error))
22427 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
22446 __Pyx_TraceLine(1288,1,__PYX_ERR(1, 1288, __pyx_L1_error))
22447 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
22457 __Pyx_TraceLine(1289,1,__PYX_ERR(1, 1289, __pyx_L1_error))
22458 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
22477 __Pyx_TraceLine(1291,1,__PYX_ERR(1, 1291, __pyx_L1_error))
22478 __pyx_t_3 = __pyx_v_dst_ndim;
22479 __pyx_t_4 = __pyx_v_src_ndim;
22480 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
22481 __pyx_t_5 = __pyx_t_3;
22483 __pyx_t_5 = __pyx_t_4;
22485 __pyx_v_ndim = __pyx_t_5;
22494 __Pyx_TraceLine(1293,1,__PYX_ERR(1, 1293, __pyx_L1_error))
22495 __pyx_t_5 = __pyx_v_ndim;
22496 __pyx_t_3 = __pyx_t_5;
22497 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
22498 __pyx_v_i = __pyx_t_4;
22507 __Pyx_TraceLine(1294,1,__PYX_ERR(1, 1294, __pyx_L1_error))
22508 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
22518 __Pyx_TraceLine(1295,1,__PYX_ERR(1, 1295, __pyx_L1_error))
22519 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
22529 __Pyx_TraceLine(1296,1,__PYX_ERR(1, 1296, __pyx_L1_error))
22530 __pyx_v_broadcasting = 1;
22539 __Pyx_TraceLine(1297,1,__PYX_ERR(1, 1297, __pyx_L1_error))
22540 (__pyx_v_src.strides[__pyx_v_i]) = 0;
22559 __Pyx_TraceLine(1299,1,__PYX_ERR(1, 1299, __pyx_L1_error))
22561 __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i]));
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1299, __pyx_L1_error)
22581 __Pyx_TraceLine(1301,1,__PYX_ERR(1, 1301, __pyx_L1_error))
22582 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
22592 __Pyx_TraceLine(1302,1,__PYX_ERR(1, 1302, __pyx_L1_error))
22593 __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Dimension %d is not direct"), __pyx_v_i);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1302, __pyx_L1_error)
22612 __Pyx_TraceLine(1304,1,__PYX_ERR(1, 1304, __pyx_L1_error))
22613 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
22623 __Pyx_TraceLine(1306,1,__PYX_ERR(1, 1306, __pyx_L1_error))
22624 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
22634 __Pyx_TraceLine(1307,1,__PYX_ERR(1, 1307, __pyx_L1_error))
22635 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
22653 __Pyx_TraceLine(1309,1,__PYX_ERR(1, 1309, __pyx_L1_error))
22654 __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim);
if (unlikely(__pyx_t_7 == ((
void *)NULL))) __PYX_ERR(1, 1309, __pyx_L1_error)
22655 __pyx_v_tmpdata = __pyx_t_7;
22664 __Pyx_TraceLine(1310,1,__PYX_ERR(1, 1310, __pyx_L1_error))
22665 __pyx_v_src = __pyx_v_tmp;
22683 __Pyx_TraceLine(1312,1,__PYX_ERR(1, 1312, __pyx_L1_error))
22684 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
22694 __Pyx_TraceLine(1315,1,__PYX_ERR(1, 1315, __pyx_L1_error))
22695 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'C', __pyx_v_ndim) != 0);
22705 __Pyx_TraceLine(1316,1,__PYX_ERR(1, 1316, __pyx_L1_error))
22706 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'C', __pyx_v_ndim);
22725 __Pyx_TraceLine(1317,1,__PYX_ERR(1, 1317, __pyx_L1_error))
22726 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'F', __pyx_v_ndim) != 0);
22736 __Pyx_TraceLine(1318,1,__PYX_ERR(1, 1318, __pyx_L1_error))
22737 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'F', __pyx_v_ndim);
22756 __Pyx_TraceLine(1320,1,__PYX_ERR(1, 1320, __pyx_L1_error))
22757 __pyx_t_2 = (__pyx_v_direct_copy != 0);
22767 __Pyx_TraceLine(1322,1,__PYX_ERR(1, 1322, __pyx_L1_error))
22768 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
22777 __Pyx_TraceLine(1323,1,__PYX_ERR(1, 1323, __pyx_L1_error))
22778 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
22787 __Pyx_TraceLine(1324,1,__PYX_ERR(1, 1324, __pyx_L1_error))
22788 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
22797 __Pyx_TraceLine(1325,1,__PYX_ERR(1, 1325, __pyx_L1_error))
22798 free(__pyx_v_tmpdata);
22807 __Pyx_TraceLine(1326,1,__PYX_ERR(1, 1326, __pyx_L1_error))
22836 __Pyx_TraceLine(1328,1,__PYX_ERR(1, 1328, __pyx_L1_error))
22837 __pyx_t_2 = (__pyx_v_order ==
'F');
22839 __pyx_t_2 = (
'F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
22841 __pyx_t_8 = (__pyx_t_2 != 0);
22851 __Pyx_TraceLine(1331,1,__PYX_ERR(1, 1331, __pyx_L1_error))
22852 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1331, __pyx_L1_error)
22861 __Pyx_TraceLine(1332,1,__PYX_ERR(1, 1332, __pyx_L1_error))
22862 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1332, __pyx_L1_error)
22880 __Pyx_TraceLine(1334,1,__PYX_ERR(1, 1334, __pyx_L1_error))
22881 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
22890 __Pyx_TraceLine(1335,1,__PYX_ERR(1, 1335, __pyx_L1_error))
22891 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
22900 __Pyx_TraceLine(1336,1,__PYX_ERR(1, 1336, __pyx_L1_error))
22901 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
22910 __Pyx_TraceLine(1338,1,__PYX_ERR(1, 1338, __pyx_L1_error))
22911 free(__pyx_v_tmpdata);
22920 __Pyx_TraceLine(1339,1,__PYX_ERR(1, 1339, __pyx_L1_error))
22936 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22938 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
22940 __Pyx_PyGILState_Release(__pyx_gilstate_save);
22945 __Pyx_TraceReturn(Py_None, 1);
22957 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim,
int __pyx_v_ndim_other) {
22959 int __pyx_v_offset;
22960 __Pyx_TraceDeclarations
22964 int __pyx_lineno = 0;
22965 const char *__pyx_filename = NULL;
22966 int __pyx_clineno = 0;
22967 __Pyx_TraceCall(
"broadcast_leading", __pyx_f[1], 1342, 1, __PYX_ERR(1, 1342, __pyx_L1_error));
22976 __Pyx_TraceLine(1346,1,__PYX_ERR(1, 1346, __pyx_L1_error))
22977 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
22986 __Pyx_TraceLine(1348,1,__PYX_ERR(1, 1348, __pyx_L1_error))
22987 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
22988 __pyx_v_i = __pyx_t_1;
22997 __Pyx_TraceLine(1349,1,__PYX_ERR(1, 1349, __pyx_L1_error))
22998 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
23007 __Pyx_TraceLine(1350,1,__PYX_ERR(1, 1350, __pyx_L1_error))
23008 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
23017 __Pyx_TraceLine(1351,1,__PYX_ERR(1, 1351, __pyx_L1_error))
23018 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
23028 __Pyx_TraceLine(1353,1,__PYX_ERR(1, 1353, __pyx_L1_error))
23029 __pyx_t_1 = __pyx_v_offset;
23030 __pyx_t_2 = __pyx_t_1;
23031 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
23032 __pyx_v_i = __pyx_t_3;
23041 __Pyx_TraceLine(1354,1,__PYX_ERR(1, 1354, __pyx_L1_error))
23042 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
23051 __Pyx_TraceLine(1355,1,__PYX_ERR(1, 1355, __pyx_L1_error))
23052 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
23061 __Pyx_TraceLine(1356,1,__PYX_ERR(1, 1356, __pyx_L1_error))
23062 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
23076 __Pyx_WriteUnraisable(
"View.MemoryView.broadcast_leading", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
23078 __Pyx_TraceReturn(Py_None, 1);
23089 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_dtype_is_object,
int __pyx_v_ndim,
int __pyx_v_inc) {
23090 __Pyx_TraceDeclarations
23092 int __pyx_lineno = 0;
23093 const char *__pyx_filename = NULL;
23094 int __pyx_clineno = 0;
23095 __Pyx_TraceCall(
"refcount_copying", __pyx_f[1], 1364, 1, __PYX_ERR(1, 1364, __pyx_L1_error));
23104 __Pyx_TraceLine(1368,1,__PYX_ERR(1, 1368, __pyx_L1_error))
23105 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
23115 __Pyx_TraceLine(1369,1,__PYX_ERR(1, 1369, __pyx_L1_error))
23116 __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
23138 __Pyx_WriteUnraisable(
"View.MemoryView.refcount_copying", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
23140 __Pyx_TraceReturn(Py_None, 1);
23151 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
23152 __Pyx_TraceDeclarations
23153 __Pyx_RefNannyDeclarations
23154 int __pyx_lineno = 0;
23155 const char *__pyx_filename = NULL;
23156 int __pyx_clineno = 0;
23158 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
23160 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice_with_gil", 0);
23161 __Pyx_TraceCall(
"refcount_objects_in_slice_with_gil", __pyx_f[1], 1373, 0, __PYX_ERR(1, 1373, __pyx_L1_error));
23170 __Pyx_TraceLine(1376,0,__PYX_ERR(1, 1376, __pyx_L1_error))
23171 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
23184 __Pyx_WriteUnraisable(
"View.MemoryView.refcount_objects_in_slice_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
23186 __Pyx_TraceReturn(Py_None, 0);
23187 __Pyx_RefNannyFinishContext();
23189 __Pyx_PyGILState_Release(__pyx_gilstate_save);
23201 static void __pyx_memoryview_refcount_objects_in_slice(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
23202 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
23203 __Pyx_TraceDeclarations
23204 __Pyx_RefNannyDeclarations
23205 Py_ssize_t __pyx_t_1;
23206 Py_ssize_t __pyx_t_2;
23207 Py_ssize_t __pyx_t_3;
23209 int __pyx_lineno = 0;
23210 const char *__pyx_filename = NULL;
23211 int __pyx_clineno = 0;
23212 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice", 0);
23213 __Pyx_TraceCall(
"refcount_objects_in_slice", __pyx_f[1], 1379, 0, __PYX_ERR(1, 1379, __pyx_L1_error));
23222 __Pyx_TraceLine(1383,0,__PYX_ERR(1, 1383, __pyx_L1_error))
23223 __pyx_t_1 = (__pyx_v_shape[0]);
23224 __pyx_t_2 = __pyx_t_1;
23225 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
23226 __pyx_v_i = __pyx_t_3;
23235 __Pyx_TraceLine(1384,0,__PYX_ERR(1, 1384, __pyx_L1_error))
23236 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
23246 __Pyx_TraceLine(1385,0,__PYX_ERR(1, 1385, __pyx_L1_error))
23247 __pyx_t_4 = (__pyx_v_inc != 0);
23257 __Pyx_TraceLine(1386,0,__PYX_ERR(1, 1386, __pyx_L1_error))
23258 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
23277 __Pyx_TraceLine(1388,0,__PYX_ERR(1, 1388, __pyx_L1_error))
23279 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
23300 __Pyx_TraceLine(1390,0,__PYX_ERR(1, 1390, __pyx_L1_error))
23310 __Pyx_TraceLine(1391,0,__PYX_ERR(1, 1391, __pyx_L1_error))
23311 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
23322 __Pyx_TraceLine(1393,0,__PYX_ERR(1, 1393, __pyx_L1_error))
23323 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
23337 __Pyx_WriteUnraisable(
"View.MemoryView.refcount_objects_in_slice", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
23339 __Pyx_TraceReturn(Py_None, 0);
23340 __Pyx_RefNannyFinishContext();
23351 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item,
int __pyx_v_dtype_is_object) {
23352 __Pyx_TraceDeclarations
23353 int __pyx_lineno = 0;
23354 const char *__pyx_filename = NULL;
23355 int __pyx_clineno = 0;
23356 __Pyx_TraceCall(
"slice_assign_scalar", __pyx_f[1], 1399, 1, __PYX_ERR(1, 1399, __pyx_L1_error));
23365 __Pyx_TraceLine(1402,1,__PYX_ERR(1, 1402, __pyx_L1_error))
23366 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
23375 __Pyx_TraceLine(1403,1,__PYX_ERR(1, 1403, __pyx_L1_error))
23376 __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
23385 __Pyx_TraceLine(1405,1,__PYX_ERR(1, 1405, __pyx_L1_error))
23386 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
23399 __Pyx_WriteUnraisable(
"View.MemoryView.slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
23401 __Pyx_TraceReturn(Py_None, 1);
23412 static void __pyx_memoryview__slice_assign_scalar(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item) {
23413 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
23414 Py_ssize_t __pyx_v_stride;
23415 Py_ssize_t __pyx_v_extent;
23416 __Pyx_TraceDeclarations
23418 Py_ssize_t __pyx_t_2;
23419 Py_ssize_t __pyx_t_3;
23420 Py_ssize_t __pyx_t_4;
23421 int __pyx_lineno = 0;
23422 const char *__pyx_filename = NULL;
23423 int __pyx_clineno = 0;
23424 __Pyx_TraceCall(
"_slice_assign_scalar", __pyx_f[1], 1409, 1, __PYX_ERR(1, 1409, __pyx_L1_error));
23433 __Pyx_TraceLine(1413,1,__PYX_ERR(1, 1413, __pyx_L1_error))
23434 __pyx_v_stride = (__pyx_v_strides[0]);
23443 __Pyx_TraceLine(1414,1,__PYX_ERR(1, 1414, __pyx_L1_error))
23444 __pyx_v_extent = (__pyx_v_shape[0]);
23453 __Pyx_TraceLine(1416,1,__PYX_ERR(1, 1416, __pyx_L1_error))
23454 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
23464 __Pyx_TraceLine(1417,1,__PYX_ERR(1, 1417, __pyx_L1_error))
23465 __pyx_t_2 = __pyx_v_extent;
23466 __pyx_t_3 = __pyx_t_2;
23467 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
23468 __pyx_v_i = __pyx_t_4;
23477 __Pyx_TraceLine(1418,1,__PYX_ERR(1, 1418, __pyx_L1_error))
23478 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
23487 __Pyx_TraceLine(1419,1,__PYX_ERR(1, 1419, __pyx_L1_error))
23488 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
23508 __Pyx_TraceLine(1421,1,__PYX_ERR(1, 1421, __pyx_L1_error))
23510 __pyx_t_2 = __pyx_v_extent;
23511 __pyx_t_3 = __pyx_t_2;
23512 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
23513 __pyx_v_i = __pyx_t_4;
23522 __Pyx_TraceLine(1422,1,__PYX_ERR(1, 1422, __pyx_L1_error))
23523 __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
23532 __Pyx_TraceLine(1424,1,__PYX_ERR(1, 1424, __pyx_L1_error))
23533 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
23549 __Pyx_WriteUnraisable(
"View.MemoryView._slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
23551 __Pyx_TraceReturn(Py_None, 1);
23561 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
23562 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {
"__pyx_unpickle_Enum", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
23563 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
23564 PyObject *__pyx_v___pyx_type = 0;
23565 long __pyx_v___pyx_checksum;
23566 PyObject *__pyx_v___pyx_state = 0;
23567 int __pyx_lineno = 0;
23568 const char *__pyx_filename = NULL;
23569 int __pyx_clineno = 0;
23570 PyObject *__pyx_r = 0;
23571 __Pyx_RefNannyDeclarations
23572 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum (wrapper)", 0);
23574 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
23575 PyObject* values[3] = {0,0,0};
23576 if (unlikely(__pyx_kwds)) {
23577 Py_ssize_t kw_args;
23578 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
23579 switch (pos_args) {
23580 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
23581 CYTHON_FALLTHROUGH;
23582 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
23583 CYTHON_FALLTHROUGH;
23584 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
23585 CYTHON_FALLTHROUGH;
23587 default:
goto __pyx_L5_argtuple_error;
23589 kw_args = PyDict_Size(__pyx_kwds);
23590 switch (pos_args) {
23592 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
23593 else goto __pyx_L5_argtuple_error;
23594 CYTHON_FALLTHROUGH;
23596 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
23598 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
23600 CYTHON_FALLTHROUGH;
23602 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
23604 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
23607 if (unlikely(kw_args > 0)) {
23608 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
23610 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
23611 goto __pyx_L5_argtuple_error;
23613 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
23614 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
23615 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
23617 __pyx_v___pyx_type = values[0];
23618 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]);
if (unlikely((__pyx_v___pyx_checksum == (
long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
23619 __pyx_v___pyx_state = values[2];
23621 goto __pyx_L4_argument_unpacking_done;
23622 __pyx_L5_argtuple_error:;
23623 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
23625 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
23626 __Pyx_RefNannyFinishContext();
23628 __pyx_L4_argument_unpacking_done:;
23629 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
23632 __Pyx_RefNannyFinishContext();
23636 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
23637 PyObject *__pyx_v___pyx_PickleError = 0;
23638 PyObject *__pyx_v___pyx_result = 0;
23639 PyObject *__pyx_r = NULL;
23640 __Pyx_TraceDeclarations
23641 __Pyx_RefNannyDeclarations
23642 PyObject *__pyx_t_1 = NULL;
23645 PyObject *__pyx_t_4 = NULL;
23646 PyObject *__pyx_t_5 = NULL;
23647 PyObject *__pyx_t_6 = NULL;
23648 int __pyx_lineno = 0;
23649 const char *__pyx_filename = NULL;
23650 int __pyx_clineno = 0;
23651 __Pyx_TraceFrameInit(__pyx_codeobj__25)
23652 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum", 0);
23653 __Pyx_TraceCall(
"__pyx_unpickle_Enum", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
23662 __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
23663 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
23664 __Pyx_GOTREF(__pyx_t_1);
23665 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__26, Py_NE));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 4, __pyx_L1_error)
23666 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23667 __pyx_t_3 = (__pyx_t_2 != 0);
23677 __Pyx_TraceLine(5,0,__PYX_ERR(1, 5, __pyx_L1_error))
23678 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
23679 __Pyx_GOTREF(__pyx_t_1);
23680 __Pyx_INCREF(__pyx_n_s_PickleError);
23681 __Pyx_GIVEREF(__pyx_n_s_PickleError);
23682 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError);
23683 __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
23684 __Pyx_GOTREF(__pyx_t_4);
23685 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23686 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
23687 __Pyx_GOTREF(__pyx_t_1);
23688 __Pyx_INCREF(__pyx_t_1);
23689 __pyx_v___pyx_PickleError = __pyx_t_1;
23690 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23691 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23700 __Pyx_TraceLine(6,0,__PYX_ERR(1, 6, __pyx_L1_error))
23701 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
23702 __Pyx_GOTREF(__pyx_t_1);
23703 __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6, __pyx_L1_error)
23704 __Pyx_GOTREF(__pyx_t_5);
23705 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23706 __Pyx_INCREF(__pyx_v___pyx_PickleError);
23707 __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL;
23708 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
23709 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
23710 if (likely(__pyx_t_6)) {
23711 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_1);
23712 __Pyx_INCREF(__pyx_t_6);
23713 __Pyx_INCREF(
function);
23714 __Pyx_DECREF_SET(__pyx_t_1,
function);
23717 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
23718 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
23719 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23720 if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
23721 __Pyx_GOTREF(__pyx_t_4);
23722 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23723 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
23724 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23725 __PYX_ERR(1, 6, __pyx_L1_error)
23743 __Pyx_TraceLine(7,0,__PYX_ERR(1, 7, __pyx_L1_error))
23744 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error)
23745 __Pyx_GOTREF(__pyx_t_1);
23747 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
23748 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
23749 if (likely(__pyx_t_5)) {
23750 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_1);
23751 __Pyx_INCREF(__pyx_t_5);
23752 __Pyx_INCREF(
function);
23753 __Pyx_DECREF_SET(__pyx_t_1,
function);
23756 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type);
23757 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
23758 if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7, __pyx_L1_error)
23759 __Pyx_GOTREF(__pyx_t_4);
23760 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23761 __pyx_v___pyx_result = __pyx_t_4;
23771 __Pyx_TraceLine(8,0,__PYX_ERR(1, 8, __pyx_L1_error))
23772 __pyx_t_3 = (__pyx_v___pyx_state != Py_None);
23773 __pyx_t_2 = (__pyx_t_3 != 0);
23783 __Pyx_TraceLine(9,0,__PYX_ERR(1, 9, __pyx_L1_error))
23784 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
23785 __pyx_t_4 = __pyx_unpickle_Enum__set_state(((
struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 9, __pyx_L1_error)
23786 __Pyx_GOTREF(__pyx_t_4);
23787 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23805 __Pyx_TraceLine(10,0,__PYX_ERR(1, 10, __pyx_L1_error))
23806 __Pyx_XDECREF(__pyx_r);
23807 __Pyx_INCREF(__pyx_v___pyx_result);
23808 __pyx_r = __pyx_v___pyx_result;
23819 __Pyx_XDECREF(__pyx_t_1);
23820 __Pyx_XDECREF(__pyx_t_4);
23821 __Pyx_XDECREF(__pyx_t_5);
23822 __Pyx_XDECREF(__pyx_t_6);
23823 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
23826 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
23827 __Pyx_XDECREF(__pyx_v___pyx_result);
23828 __Pyx_XGIVEREF(__pyx_r);
23829 __Pyx_TraceReturn(__pyx_r, 0);
23830 __Pyx_RefNannyFinishContext();
23842 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
23843 PyObject *__pyx_r = NULL;
23844 __Pyx_TraceDeclarations
23845 __Pyx_RefNannyDeclarations
23846 PyObject *__pyx_t_1 = NULL;
23848 Py_ssize_t __pyx_t_3;
23851 PyObject *__pyx_t_6 = NULL;
23852 PyObject *__pyx_t_7 = NULL;
23853 PyObject *__pyx_t_8 = NULL;
23854 int __pyx_lineno = 0;
23855 const char *__pyx_filename = NULL;
23856 int __pyx_clineno = 0;
23857 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum__set_state", 0);
23858 __Pyx_TraceCall(
"__pyx_unpickle_Enum__set_state", __pyx_f[1], 11, 0, __PYX_ERR(1, 11, __pyx_L1_error));
23867 __Pyx_TraceLine(12,0,__PYX_ERR(1, 12, __pyx_L1_error))
23868 if (unlikely(__pyx_v___pyx_state == Py_None)) {
23869 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
23870 __PYX_ERR(1, 12, __pyx_L1_error)
23872 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
23873 __Pyx_GOTREF(__pyx_t_1);
23874 __Pyx_GIVEREF(__pyx_t_1);
23875 __Pyx_GOTREF(__pyx_v___pyx_result->name);
23876 __Pyx_DECREF(__pyx_v___pyx_result->name);
23877 __pyx_v___pyx_result->name = __pyx_t_1;
23886 __Pyx_TraceLine(13,0,__PYX_ERR(1, 13, __pyx_L1_error))
23887 if (unlikely(__pyx_v___pyx_state == Py_None)) {
23888 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
23889 __PYX_ERR(1, 13, __pyx_L1_error)
23891 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state);
if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
23892 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
23895 __pyx_t_2 = __pyx_t_4;
23896 goto __pyx_L4_bool_binop_done;
23898 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
23899 __pyx_t_5 = (__pyx_t_4 != 0);
23900 __pyx_t_2 = __pyx_t_5;
23901 __pyx_L4_bool_binop_done:;
23909 __Pyx_TraceLine(14,0,__PYX_ERR(1, 14, __pyx_L1_error))
23910 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
23911 __Pyx_GOTREF(__pyx_t_6);
23912 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
23913 __Pyx_GOTREF(__pyx_t_7);
23914 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23915 if (unlikely(__pyx_v___pyx_state == Py_None)) {
23916 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
23917 __PYX_ERR(1, 14, __pyx_L1_error)
23919 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
23920 __Pyx_GOTREF(__pyx_t_6);
23922 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
23923 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
23924 if (likely(__pyx_t_8)) {
23925 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_7);
23926 __Pyx_INCREF(__pyx_t_8);
23927 __Pyx_INCREF(
function);
23928 __Pyx_DECREF_SET(__pyx_t_7,
function);
23931 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
23932 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
23933 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23934 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
23935 __Pyx_GOTREF(__pyx_t_1);
23936 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
23937 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23956 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23959 __Pyx_XDECREF(__pyx_t_1);
23960 __Pyx_XDECREF(__pyx_t_6);
23961 __Pyx_XDECREF(__pyx_t_7);
23962 __Pyx_XDECREF(__pyx_t_8);
23963 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
23966 __Pyx_XGIVEREF(__pyx_r);
23967 __Pyx_TraceReturn(__pyx_r, 0);
23968 __Pyx_RefNannyFinishContext();
23971 static struct __pyx_vtabstruct_array __pyx_vtable_array;
23973 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
23974 struct __pyx_array_obj *p;
23976 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
23977 o = (*t->tp_alloc)(t, 0);
23979 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
23981 if (unlikely(!o))
return 0;
23982 p = ((
struct __pyx_array_obj *)o);
23983 p->__pyx_vtab = __pyx_vtabptr_array;
23984 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
23985 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
23986 if (unlikely(__pyx_array___cinit__(o, a, k) < 0))
goto bad;
23989 Py_DECREF(o); o = 0;
23993 static void __pyx_tp_dealloc_array(PyObject *o) {
23994 struct __pyx_array_obj *p = (
struct __pyx_array_obj *)o;
23995 #if CYTHON_USE_TP_FINALIZE
23996 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
23997 if (PyObject_CallFinalizerFromDealloc(o))
return;
24001 PyObject *etype, *eval, *etb;
24002 PyErr_Fetch(&etype, &eval, &etb);
24003 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
24004 __pyx_array___dealloc__(o);
24005 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
24006 PyErr_Restore(etype, eval, etb);
24009 Py_CLEAR(p->_format);
24010 (*Py_TYPE(o)->tp_free)(o);
24012 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
24014 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
24015 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
24020 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
24022 return __pyx_array___setitem__(o, i, v);
24025 PyErr_Format(PyExc_NotImplementedError,
24026 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
24031 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
24032 PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
24033 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
24035 v = __pyx_array___getattr__(o, n);
24040 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED
void *x) {
24041 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
24044 static PyMethodDef __pyx_methods_array[] = {
24045 {
"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
24046 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
24047 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
24051 static struct PyGetSetDef __pyx_getsets_array[] = {
24052 {(
char *)
"memview", __pyx_getprop___pyx_array_memview, 0, (
char *)0, 0},
24056 static PySequenceMethods __pyx_tp_as_sequence_array = {
24057 __pyx_array___len__,
24060 __pyx_sq_item_array,
24069 static PyMappingMethods __pyx_tp_as_mapping_array = {
24070 __pyx_array___len__,
24071 __pyx_array___getitem__,
24072 __pyx_mp_ass_subscript_array,
24075 static PyBufferProcs __pyx_tp_as_buffer_array = {
24076 #if PY_MAJOR_VERSION < 3
24079 #if PY_MAJOR_VERSION < 3
24082 #if PY_MAJOR_VERSION < 3
24085 #if PY_MAJOR_VERSION < 3
24088 __pyx_array_getbuffer,
24092 static PyTypeObject __pyx_type___pyx_array = {
24093 PyVarObject_HEAD_INIT(0, 0)
24094 "imate.traceinv._hutchinson_method.array",
24095 sizeof(
struct __pyx_array_obj),
24097 __pyx_tp_dealloc_array,
24098 #
if PY_VERSION_HEX < 0x030800b4
24101 #
if PY_VERSION_HEX >= 0x030800b4
24106 #
if PY_MAJOR_VERSION < 3
24109 #
if PY_MAJOR_VERSION >= 3
24114 &__pyx_tp_as_sequence_array,
24115 &__pyx_tp_as_mapping_array,
24119 __pyx_tp_getattro_array,
24121 &__pyx_tp_as_buffer_array,
24122 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
24130 __pyx_methods_array,
24132 __pyx_getsets_array,
24140 __pyx_tp_new_array,
24150 #
if PY_VERSION_HEX >= 0x030400a1
24153 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
24156 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24159 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
24164 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
24165 struct __pyx_MemviewEnum_obj *p;
24167 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
24168 o = (*t->tp_alloc)(t, 0);
24170 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
24172 if (unlikely(!o))
return 0;
24173 p = ((
struct __pyx_MemviewEnum_obj *)o);
24174 p->name = Py_None; Py_INCREF(Py_None);
24178 static void __pyx_tp_dealloc_Enum(PyObject *o) {
24179 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
24180 #if CYTHON_USE_TP_FINALIZE
24181 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
24182 if (PyObject_CallFinalizerFromDealloc(o))
return;
24185 PyObject_GC_UnTrack(o);
24187 (*Py_TYPE(o)->tp_free)(o);
24190 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v,
void *a) {
24192 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
24194 e = (*v)(p->name, a);
if (e)
return e;
24199 static int __pyx_tp_clear_Enum(PyObject *o) {
24201 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
24202 tmp = ((PyObject*)p->name);
24203 p->name = Py_None; Py_INCREF(Py_None);
24208 static PyMethodDef __pyx_methods_Enum[] = {
24209 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
24210 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
24214 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
24215 PyVarObject_HEAD_INIT(0, 0)
24216 "imate.traceinv._hutchinson_method.Enum",
24217 sizeof(
struct __pyx_MemviewEnum_obj),
24219 __pyx_tp_dealloc_Enum,
24220 #
if PY_VERSION_HEX < 0x030800b4
24223 #
if PY_VERSION_HEX >= 0x030800b4
24228 #
if PY_MAJOR_VERSION < 3
24231 #
if PY_MAJOR_VERSION >= 3
24234 __pyx_MemviewEnum___repr__,
24244 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
24246 __pyx_tp_traverse_Enum,
24247 __pyx_tp_clear_Enum,
24252 __pyx_methods_Enum,
24260 __pyx_MemviewEnum___init__,
24272 #
if PY_VERSION_HEX >= 0x030400a1
24275 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
24278 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24281 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
24285 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
24287 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
24288 struct __pyx_memoryview_obj *p;
24290 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
24291 o = (*t->tp_alloc)(t, 0);
24293 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
24295 if (unlikely(!o))
return 0;
24296 p = ((
struct __pyx_memoryview_obj *)o);
24297 p->__pyx_vtab = __pyx_vtabptr_memoryview;
24298 p->obj = Py_None; Py_INCREF(Py_None);
24299 p->_size = Py_None; Py_INCREF(Py_None);
24300 p->_array_interface = Py_None; Py_INCREF(Py_None);
24301 p->view.obj = NULL;
24302 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0))
goto bad;
24305 Py_DECREF(o); o = 0;
24309 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
24310 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
24311 #if CYTHON_USE_TP_FINALIZE
24312 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
24313 if (PyObject_CallFinalizerFromDealloc(o))
return;
24316 PyObject_GC_UnTrack(o);
24318 PyObject *etype, *eval, *etb;
24319 PyErr_Fetch(&etype, &eval, &etb);
24320 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
24321 __pyx_memoryview___dealloc__(o);
24322 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
24323 PyErr_Restore(etype, eval, etb);
24326 Py_CLEAR(p->_size);
24327 Py_CLEAR(p->_array_interface);
24328 (*Py_TYPE(o)->tp_free)(o);
24331 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v,
void *a) {
24333 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
24335 e = (*v)(p->obj, a);
if (e)
return e;
24338 e = (*v)(p->_size, a);
if (e)
return e;
24340 if (p->_array_interface) {
24341 e = (*v)(p->_array_interface, a);
if (e)
return e;
24344 e = (*v)(p->view.obj, a);
if (e)
return e;
24349 static int __pyx_tp_clear_memoryview(PyObject *o) {
24351 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
24352 tmp = ((PyObject*)p->obj);
24353 p->obj = Py_None; Py_INCREF(Py_None);
24355 tmp = ((PyObject*)p->_size);
24356 p->_size = Py_None; Py_INCREF(Py_None);
24358 tmp = ((PyObject*)p->_array_interface);
24359 p->_array_interface = Py_None; Py_INCREF(Py_None);
24361 Py_CLEAR(p->view.obj);
24364 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
24366 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
24367 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
24372 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
24374 return __pyx_memoryview___setitem__(o, i, v);
24377 PyErr_Format(PyExc_NotImplementedError,
24378 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
24383 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED
void *x) {
24384 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
24387 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED
void *x) {
24388 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
24391 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED
void *x) {
24392 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
24395 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED
void *x) {
24396 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
24399 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED
void *x) {
24400 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
24403 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED
void *x) {
24404 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
24407 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED
void *x) {
24408 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
24411 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED
void *x) {
24412 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
24415 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED
void *x) {
24416 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
24419 static PyMethodDef __pyx_methods_memoryview[] = {
24420 {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
24421 {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
24422 {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
24423 {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
24424 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
24425 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
24429 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
24430 {(
char *)
"T", __pyx_getprop___pyx_memoryview_T, 0, (
char *)0, 0},
24431 {(
char *)
"base", __pyx_getprop___pyx_memoryview_base, 0, (
char *)0, 0},
24432 {(
char *)
"shape", __pyx_getprop___pyx_memoryview_shape, 0, (
char *)0, 0},
24433 {(
char *)
"strides", __pyx_getprop___pyx_memoryview_strides, 0, (
char *)0, 0},
24434 {(
char *)
"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (
char *)0, 0},
24435 {(
char *)
"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (
char *)0, 0},
24436 {(
char *)
"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (
char *)0, 0},
24437 {(
char *)
"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (
char *)0, 0},
24438 {(
char *)
"size", __pyx_getprop___pyx_memoryview_size, 0, (
char *)0, 0},
24442 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
24443 __pyx_memoryview___len__,
24446 __pyx_sq_item_memoryview,
24455 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
24456 __pyx_memoryview___len__,
24457 __pyx_memoryview___getitem__,
24458 __pyx_mp_ass_subscript_memoryview,
24461 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
24462 #if PY_MAJOR_VERSION < 3
24465 #if PY_MAJOR_VERSION < 3
24468 #if PY_MAJOR_VERSION < 3
24471 #if PY_MAJOR_VERSION < 3
24474 __pyx_memoryview_getbuffer,
24478 static PyTypeObject __pyx_type___pyx_memoryview = {
24479 PyVarObject_HEAD_INIT(0, 0)
24480 "imate.traceinv._hutchinson_method.memoryview",
24481 sizeof(
struct __pyx_memoryview_obj),
24483 __pyx_tp_dealloc_memoryview,
24484 #
if PY_VERSION_HEX < 0x030800b4
24487 #
if PY_VERSION_HEX >= 0x030800b4
24492 #
if PY_MAJOR_VERSION < 3
24495 #
if PY_MAJOR_VERSION >= 3
24498 __pyx_memoryview___repr__,
24500 &__pyx_tp_as_sequence_memoryview,
24501 &__pyx_tp_as_mapping_memoryview,
24504 __pyx_memoryview___str__,
24507 &__pyx_tp_as_buffer_memoryview,
24508 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
24510 __pyx_tp_traverse_memoryview,
24511 __pyx_tp_clear_memoryview,
24516 __pyx_methods_memoryview,
24518 __pyx_getsets_memoryview,
24526 __pyx_tp_new_memoryview,
24536 #
if PY_VERSION_HEX >= 0x030400a1
24539 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
24542 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24545 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
24549 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
24551 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
24552 struct __pyx_memoryviewslice_obj *p;
24553 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
24554 if (unlikely(!o))
return 0;
24555 p = ((
struct __pyx_memoryviewslice_obj *)o);
24556 p->__pyx_base.__pyx_vtab = (
struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
24557 p->from_object = Py_None; Py_INCREF(Py_None);
24558 p->from_slice.memview = NULL;
24562 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
24563 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
24564 #if CYTHON_USE_TP_FINALIZE
24565 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
24566 if (PyObject_CallFinalizerFromDealloc(o))
return;
24569 PyObject_GC_UnTrack(o);
24571 PyObject *etype, *eval, *etb;
24572 PyErr_Fetch(&etype, &eval, &etb);
24573 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
24574 __pyx_memoryviewslice___dealloc__(o);
24575 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
24576 PyErr_Restore(etype, eval, etb);
24578 Py_CLEAR(p->from_object);
24579 PyObject_GC_Track(o);
24580 __pyx_tp_dealloc_memoryview(o);
24583 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v,
void *a) {
24585 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
24586 e = __pyx_tp_traverse_memoryview(o, v, a);
if (e)
return e;
24587 if (p->from_object) {
24588 e = (*v)(p->from_object, a);
if (e)
return e;
24593 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
24595 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
24596 __pyx_tp_clear_memoryview(o);
24597 tmp = ((PyObject*)p->from_object);
24598 p->from_object = Py_None; Py_INCREF(Py_None);
24600 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
24604 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED
void *x) {
24605 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
24608 static PyMethodDef __pyx_methods__memoryviewslice[] = {
24609 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
24610 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
24614 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
24615 {(
char *)
"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (
char *)0, 0},
24619 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
24620 PyVarObject_HEAD_INIT(0, 0)
24621 "imate.traceinv._hutchinson_method._memoryviewslice",
24622 sizeof(
struct __pyx_memoryviewslice_obj),
24624 __pyx_tp_dealloc__memoryviewslice,
24625 #
if PY_VERSION_HEX < 0x030800b4
24628 #
if PY_VERSION_HEX >= 0x030800b4
24633 #
if PY_MAJOR_VERSION < 3
24636 #
if PY_MAJOR_VERSION >= 3
24639 #
if CYTHON_COMPILING_IN_PYPY
24640 __pyx_memoryview___repr__,
24649 #
if CYTHON_COMPILING_IN_PYPY
24650 __pyx_memoryview___str__,
24657 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
24658 "Internal class for passing memoryview slices to Python",
24659 __pyx_tp_traverse__memoryviewslice,
24660 __pyx_tp_clear__memoryviewslice,
24665 __pyx_methods__memoryviewslice,
24667 __pyx_getsets__memoryviewslice,
24675 __pyx_tp_new__memoryviewslice,
24685 #
if PY_VERSION_HEX >= 0x030400a1
24688 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
24691 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24694 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
24699 static PyMethodDef __pyx_methods[] = {
24703 #if PY_MAJOR_VERSION >= 3
24704 #if CYTHON_PEP489_MULTI_PHASE_INIT
24705 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
24706 static int __pyx_pymod_exec__hutchinson_method(PyObject* module);
24707 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
24708 {Py_mod_create, (
void*)__pyx_pymod_create},
24709 {Py_mod_exec, (
void*)__pyx_pymod_exec__hutchinson_method},
24714 static struct PyModuleDef __pyx_moduledef = {
24715 PyModuleDef_HEAD_INIT,
24716 "_hutchinson_method",
24718 #if CYTHON_PEP489_MULTI_PHASE_INIT
24724 #if CYTHON_PEP489_MULTI_PHASE_INIT
24725 __pyx_moduledef_slots,
24734 #ifndef CYTHON_SMALL_CODE
24735 #if defined(__clang__)
24736 #define CYTHON_SMALL_CODE
24737 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
24738 #define CYTHON_SMALL_CODE __attribute__((cold))
24740 #define CYTHON_SMALL_CODE
24744 static __Pyx_StringTabEntry __pyx_string_tab[] = {
24745 {&__pyx_n_s_A, __pyx_k_A,
sizeof(__pyx_k_A), 0, 0, 1, 1},
24746 {&__pyx_n_s_ASCII, __pyx_k_ASCII,
sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
24747 {&__pyx_n_s_AinvpE, __pyx_k_AinvpE,
sizeof(__pyx_k_AinvpE), 0, 0, 1, 1},
24748 {&__pyx_n_s_AtA, __pyx_k_AtA,
sizeof(__pyx_k_AtA), 0, 0, 1, 1},
24749 {&__pyx_kp_u_AtA_cannot_be_None, __pyx_k_AtA_cannot_be_None,
sizeof(__pyx_k_AtA_cannot_be_None), 0, 1, 0, 0},
24750 {&__pyx_n_s_B, __pyx_k_B,
sizeof(__pyx_k_B), 0, 0, 1, 1},
24751 {&__pyx_n_s_BE, __pyx_k_BE,
sizeof(__pyx_k_BE), 0, 0, 1, 1},
24752 {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri,
sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
24753 {&__pyx_n_s_C, __pyx_k_C,
sizeof(__pyx_k_C), 0, 0, 1, 1},
24754 {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is,
sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
24755 {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor,
sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
24756 {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi,
sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
24757 {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s,
sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
24758 {&__pyx_kp_u_Data_type_should_be_either_float, __pyx_k_Data_type_should_be_either_float,
sizeof(__pyx_k_Data_type_should_be_either_float), 0, 1, 0, 0},
24759 {&__pyx_n_s_E, __pyx_k_E,
sizeof(__pyx_k_E), 0, 0, 1, 1},
24760 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis,
sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
24761 {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr,
sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
24762 {&__pyx_n_u_F, __pyx_k_F,
sizeof(__pyx_k_F), 0, 1, 0, 1},
24763 {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0,
sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0},
24764 {&__pyx_n_s_IndexError, __pyx_k_IndexError,
sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
24765 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte,
sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
24766 {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr,
sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
24767 {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d,
sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
24768 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError,
sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
24769 {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x,
sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
24770 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object,
sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
24771 {&__pyx_n_b_O, __pyx_k_O,
sizeof(__pyx_k_O), 0, 0, 0, 1},
24772 {&__pyx_n_s_OpE, __pyx_k_OpE,
sizeof(__pyx_k_OpE), 0, 0, 1, 1},
24773 {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a,
sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
24774 {&__pyx_n_s_PickleError, __pyx_k_PickleError,
sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
24775 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError,
sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
24776 {&__pyx_n_s_T, __pyx_k_T,
sizeof(__pyx_k_T), 0, 0, 1, 1},
24777 {&__pyx_kp_u_Trace_of_matrix_or_linear_opera, __pyx_k_Trace_of_matrix_or_linear_opera,
sizeof(__pyx_k_Trace_of_matrix_or_linear_opera), 0, 1, 0, 0},
24778 {&__pyx_n_s_TypeError, __pyx_k_TypeError,
sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
24779 {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object,
sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
24780 {&__pyx_n_s_ValueError, __pyx_k_ValueError,
sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
24781 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView,
sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
24782 {&__pyx_n_s_abs, __pyx_k_abs,
sizeof(__pyx_k_abs), 0, 0, 1, 1},
24783 {&__pyx_n_u_absolute_error, __pyx_k_absolute_error,
sizeof(__pyx_k_absolute_error), 0, 1, 0, 1},
24784 {&__pyx_n_s_alg_wall_time, __pyx_k_alg_wall_time,
sizeof(__pyx_k_alg_wall_time), 0, 0, 1, 1},
24785 {&__pyx_n_u_alg_wall_time, __pyx_k_alg_wall_time,
sizeof(__pyx_k_alg_wall_time), 0, 1, 0, 1},
24786 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer,
sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
24787 {&__pyx_n_s_assume_matrix, __pyx_k_assume_matrix,
sizeof(__pyx_k_assume_matrix), 0, 0, 1, 1},
24788 {&__pyx_n_u_assume_matrix, __pyx_k_assume_matrix,
sizeof(__pyx_k_assume_matrix), 0, 1, 0, 1},
24789 {&__pyx_n_s_average_estimates, __pyx_k_average_estimates,
sizeof(__pyx_k_average_estimates), 0, 0, 1, 1},
24790 {&__pyx_n_s_base, __pyx_k_base,
sizeof(__pyx_k_base), 0, 0, 1, 1},
24791 {&__pyx_n_s_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 0, 1, 1},
24792 {&__pyx_n_u_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 1, 0, 1},
24793 {&__pyx_n_s_cE, __pyx_k_cE,
sizeof(__pyx_k_cE), 0, 0, 1, 1},
24794 {&__pyx_n_s_check_arguments, __pyx_k_check_arguments,
sizeof(__pyx_k_check_arguments), 0, 0, 1, 1},
24795 {&__pyx_n_s_check_convergence, __pyx_k_check_convergence,
sizeof(__pyx_k_check_convergence), 0, 0, 1, 1},
24796 {&__pyx_n_s_class, __pyx_k_class,
sizeof(__pyx_k_class), 0, 0, 1, 1},
24797 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
24798 {&__pyx_n_s_confidence_level, __pyx_k_confidence_level,
sizeof(__pyx_k_confidence_level), 0, 0, 1, 1},
24799 {&__pyx_n_u_confidence_level, __pyx_k_confidence_level,
sizeof(__pyx_k_confidence_level), 0, 1, 0, 1},
24800 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct,
sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
24801 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect,
sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
24802 {&__pyx_n_s_converged, __pyx_k_converged,
sizeof(__pyx_k_converged), 0, 0, 1, 1},
24803 {&__pyx_n_u_converged, __pyx_k_converged,
sizeof(__pyx_k_converged), 0, 1, 0, 1},
24804 {&__pyx_n_u_convergence, __pyx_k_convergence,
sizeof(__pyx_k_convergence), 0, 1, 0, 1},
24805 {&__pyx_n_s_convergence_tools, __pyx_k_convergence_tools,
sizeof(__pyx_k_convergence_tools), 0, 0, 1, 1},
24806 {&__pyx_n_s_cpu_count, __pyx_k_cpu_count,
sizeof(__pyx_k_cpu_count), 0, 0, 1, 1},
24807 {&__pyx_n_s_cpu_proc_time, __pyx_k_cpu_proc_time,
sizeof(__pyx_k_cpu_proc_time), 0, 0, 1, 1},
24808 {&__pyx_n_u_cpu_proc_time, __pyx_k_cpu_proc_time,
sizeof(__pyx_k_cpu_proc_time), 0, 1, 0, 1},
24809 {&__pyx_n_u_data_type, __pyx_k_data_type,
sizeof(__pyx_k_data_type), 0, 1, 0, 1},
24810 {&__pyx_n_s_data_type_name, __pyx_k_data_type_name,
sizeof(__pyx_k_data_type_name), 0, 0, 1, 1},
24811 {&__pyx_n_u_density, __pyx_k_density,
sizeof(__pyx_k_density), 0, 1, 0, 1},
24812 {&__pyx_n_u_device, __pyx_k_device,
sizeof(__pyx_k_device), 0, 1, 0, 1},
24813 {&__pyx_n_s_dict, __pyx_k_dict,
sizeof(__pyx_k_dict), 0, 0, 1, 1},
24814 {&__pyx_n_s_dtype, __pyx_k_dtype,
sizeof(__pyx_k_dtype), 0, 0, 1, 1},
24815 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object,
sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
24816 {&__pyx_n_s_empty, __pyx_k_empty,
sizeof(__pyx_k_empty), 0, 0, 1, 1},
24817 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
24818 {&__pyx_n_s_enumerate, __pyx_k_enumerate,
sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
24819 {&__pyx_n_s_eps, __pyx_k_eps,
sizeof(__pyx_k_eps), 0, 0, 1, 1},
24820 {&__pyx_n_s_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 0, 1, 1},
24821 {&__pyx_n_u_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 1, 0, 1},
24822 {&__pyx_n_s_error_atol, __pyx_k_error_atol,
sizeof(__pyx_k_error_atol), 0, 0, 1, 1},
24823 {&__pyx_n_u_error_atol, __pyx_k_error_atol,
sizeof(__pyx_k_error_atol), 0, 1, 0, 1},
24824 {&__pyx_n_s_error_rtol, __pyx_k_error_rtol,
sizeof(__pyx_k_error_rtol), 0, 0, 1, 1},
24825 {&__pyx_n_u_error_rtol, __pyx_k_error_rtol,
sizeof(__pyx_k_error_rtol), 0, 1, 0, 1},
24826 {&__pyx_n_u_exponent, __pyx_k_exponent,
sizeof(__pyx_k_exponent), 0, 1, 0, 1},
24827 {&__pyx_n_s_finfo, __pyx_k_finfo,
sizeof(__pyx_k_finfo), 0, 0, 1, 1},
24828 {&__pyx_n_s_flags, __pyx_k_flags,
sizeof(__pyx_k_flags), 0, 0, 1, 1},
24829 {&__pyx_n_b_float32, __pyx_k_float32,
sizeof(__pyx_k_float32), 0, 0, 0, 1},
24830 {&__pyx_n_s_float32, __pyx_k_float32,
sizeof(__pyx_k_float32), 0, 0, 1, 1},
24831 {&__pyx_n_b_float64, __pyx_k_float64,
sizeof(__pyx_k_float64), 0, 0, 0, 1},
24832 {&__pyx_n_s_float64, __pyx_k_float64,
sizeof(__pyx_k_float64), 0, 0, 1, 1},
24833 {&__pyx_n_s_format, __pyx_k_format,
sizeof(__pyx_k_format), 0, 0, 1, 1},
24834 {&__pyx_n_s_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 0, 1, 1},
24835 {&__pyx_n_u_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 1, 0, 1},
24836 {&__pyx_n_u_gen, __pyx_k_gen,
sizeof(__pyx_k_gen), 0, 1, 0, 1},
24837 {&__pyx_n_s_get_data_type_name, __pyx_k_get_data_type_name,
sizeof(__pyx_k_get_data_type_name), 0, 0, 1, 1},
24838 {&__pyx_n_s_get_density, __pyx_k_get_density,
sizeof(__pyx_k_get_density), 0, 0, 1, 1},
24839 {&__pyx_n_s_get_nnz, __pyx_k_get_nnz,
sizeof(__pyx_k_get_nnz), 0, 0, 1, 1},
24840 {&__pyx_n_s_getstate, __pyx_k_getstate,
sizeof(__pyx_k_getstate), 0, 0, 1, 1},
24841 {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi,
sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
24842 {&__pyx_n_s_gram, __pyx_k_gram,
sizeof(__pyx_k_gram), 0, 0, 1, 1},
24843 {&__pyx_n_u_gram, __pyx_k_gram,
sizeof(__pyx_k_gram), 0, 1, 0, 1},
24844 {&__pyx_n_u_hutchinson, __pyx_k_hutchinson,
sizeof(__pyx_k_hutchinson), 0, 1, 0, 1},
24845 {&__pyx_n_s_hutchinson_method, __pyx_k_hutchinson_method,
sizeof(__pyx_k_hutchinson_method), 0, 0, 1, 1},
24846 {&__pyx_n_s_hutchinson_method_double, __pyx_k_hutchinson_method_double,
sizeof(__pyx_k_hutchinson_method_double), 0, 0, 1, 1},
24847 {&__pyx_n_s_hutchinson_method_float, __pyx_k_hutchinson_method_float,
sizeof(__pyx_k_hutchinson_method_float), 0, 0, 1, 1},
24848 {&__pyx_kp_u_hutchinson_method_line_37, __pyx_k_hutchinson_method_line_37,
sizeof(__pyx_k_hutchinson_method_line_37), 0, 1, 0, 0},
24849 {&__pyx_n_s_hutchinson_method_utilities, __pyx_k_hutchinson_method_utilities,
sizeof(__pyx_k_hutchinson_method_utilities), 0, 0, 1, 1},
24850 {&__pyx_n_s_i, __pyx_k_i,
sizeof(__pyx_k_i), 0, 0, 1, 1},
24851 {&__pyx_n_s_id, __pyx_k_id,
sizeof(__pyx_k_id), 0, 0, 1, 1},
24852 {&__pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_k_imate_traceinv__hutchinson_metho,
sizeof(__pyx_k_imate_traceinv__hutchinson_metho), 0, 0, 1, 0},
24853 {&__pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_k_imate_traceinv__hutchinson_metho_2,
sizeof(__pyx_k_imate_traceinv__hutchinson_metho_2), 0, 0, 1, 1},
24854 {&__pyx_n_s_imatmul, __pyx_k_imatmul,
sizeof(__pyx_k_imatmul), 0, 0, 1, 1},
24855 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
24856 {&__pyx_n_s_info, __pyx_k_info,
sizeof(__pyx_k_info), 0, 0, 1, 1},
24857 {&__pyx_n_s_init_alg_wall_time, __pyx_k_init_alg_wall_time,
sizeof(__pyx_k_init_alg_wall_time), 0, 0, 1, 1},
24858 {&__pyx_n_s_init_cpu_proc_time, __pyx_k_init_cpu_proc_time,
sizeof(__pyx_k_init_cpu_proc_time), 0, 0, 1, 1},
24859 {&__pyx_n_s_init_tot_wall_time, __pyx_k_init_tot_wall_time,
sizeof(__pyx_k_init_tot_wall_time), 0, 0, 1, 1},
24860 {&__pyx_n_s_isspmatrix, __pyx_k_isspmatrix,
sizeof(__pyx_k_isspmatrix), 0, 0, 1, 1},
24861 {&__pyx_n_s_itemsize, __pyx_k_itemsize,
sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
24862 {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array,
sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
24863 {&__pyx_n_s_linear_algebra, __pyx_k_linear_algebra,
sizeof(__pyx_k_linear_algebra), 0, 0, 1, 1},
24864 {&__pyx_n_s_linear_algebra_matrix_utilities, __pyx_k_linear_algebra_matrix_utilities,
sizeof(__pyx_k_linear_algebra_matrix_utilities), 0, 0, 1, 1},
24865 {&__pyx_n_s_linear_solver, __pyx_k_linear_solver,
sizeof(__pyx_k_linear_solver), 0, 0, 1, 1},
24866 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
24867 {&__pyx_n_s_matmul, __pyx_k_matmul,
sizeof(__pyx_k_matmul), 0, 0, 1, 1},
24868 {&__pyx_n_u_matrix, __pyx_k_matrix,
sizeof(__pyx_k_matrix), 0, 1, 0, 1},
24869 {&__pyx_n_s_max_num_samples, __pyx_k_max_num_samples,
sizeof(__pyx_k_max_num_samples), 0, 0, 1, 1},
24870 {&__pyx_n_u_max_num_samples, __pyx_k_max_num_samples,
sizeof(__pyx_k_max_num_samples), 0, 1, 0, 1},
24871 {&__pyx_n_s_memoryview_E, __pyx_k_memoryview_E,
sizeof(__pyx_k_memoryview_E), 0, 0, 1, 1},
24872 {&__pyx_n_s_memview, __pyx_k_memview,
sizeof(__pyx_k_memview), 0, 0, 1, 1},
24873 {&__pyx_n_u_method, __pyx_k_method,
sizeof(__pyx_k_method), 0, 1, 0, 1},
24874 {&__pyx_n_s_min_num_samples, __pyx_k_min_num_samples,
sizeof(__pyx_k_min_num_samples), 0, 0, 1, 1},
24875 {&__pyx_n_u_min_num_samples, __pyx_k_min_num_samples,
sizeof(__pyx_k_min_num_samples), 0, 1, 0, 1},
24876 {&__pyx_n_s_mode, __pyx_k_mode,
sizeof(__pyx_k_mode), 0, 0, 1, 1},
24877 {&__pyx_n_s_multiprocessing, __pyx_k_multiprocessing,
sizeof(__pyx_k_multiprocessing), 0, 0, 1, 1},
24878 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
24879 {&__pyx_n_s_name_2, __pyx_k_name_2,
sizeof(__pyx_k_name_2), 0, 0, 1, 1},
24880 {&__pyx_n_s_nan, __pyx_k_nan,
sizeof(__pyx_k_nan), 0, 0, 1, 1},
24881 {&__pyx_n_s_ndim, __pyx_k_ndim,
sizeof(__pyx_k_ndim), 0, 0, 1, 1},
24882 {&__pyx_n_s_new, __pyx_k_new,
sizeof(__pyx_k_new), 0, 0, 1, 1},
24883 {&__pyx_n_u_nnz, __pyx_k_nnz,
sizeof(__pyx_k_nnz), 0, 1, 0, 1},
24884 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non,
sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
24885 {&__pyx_n_u_num_cpu_threads, __pyx_k_num_cpu_threads,
sizeof(__pyx_k_num_cpu_threads), 0, 1, 0, 1},
24886 {&__pyx_n_u_num_gpu_devices, __pyx_k_num_gpu_devices,
sizeof(__pyx_k_num_gpu_devices), 0, 1, 0, 1},
24887 {&__pyx_n_u_num_gpu_multiprocessors, __pyx_k_num_gpu_multiprocessors,
sizeof(__pyx_k_num_gpu_multiprocessors), 0, 1, 0, 1},
24888 {&__pyx_n_u_num_gpu_threads_per_multiprocess, __pyx_k_num_gpu_threads_per_multiprocess,
sizeof(__pyx_k_num_gpu_threads_per_multiprocess), 0, 1, 0, 1},
24889 {&__pyx_n_u_num_inquiries, __pyx_k_num_inquiries,
sizeof(__pyx_k_num_inquiries), 0, 1, 0, 1},
24890 {&__pyx_n_s_num_outliers, __pyx_k_num_outliers,
sizeof(__pyx_k_num_outliers), 0, 0, 1, 1},
24891 {&__pyx_n_u_num_outliers, __pyx_k_num_outliers,
sizeof(__pyx_k_num_outliers), 0, 1, 0, 1},
24892 {&__pyx_n_s_num_processed_samples, __pyx_k_num_processed_samples,
sizeof(__pyx_k_num_processed_samples), 0, 0, 1, 1},
24893 {&__pyx_n_s_num_samples_used, __pyx_k_num_samples_used,
sizeof(__pyx_k_num_samples_used), 0, 0, 1, 1},
24894 {&__pyx_n_u_num_samples_used, __pyx_k_num_samples_used,
sizeof(__pyx_k_num_samples_used), 0, 1, 0, 1},
24895 {&__pyx_n_s_num_threads, __pyx_k_num_threads,
sizeof(__pyx_k_num_threads), 0, 0, 1, 1},
24896 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
24897 {&__pyx_n_s_obj, __pyx_k_obj,
sizeof(__pyx_k_obj), 0, 0, 1, 1},
24898 {&__pyx_n_s_operator_dot, __pyx_k_operator_dot,
sizeof(__pyx_k_operator_dot), 0, 0, 1, 1},
24899 {&__pyx_n_s_order, __pyx_k_order,
sizeof(__pyx_k_order), 0, 0, 1, 1},
24900 {&__pyx_n_s_orthogonalize, __pyx_k_orthogonalize,
sizeof(__pyx_k_orthogonalize), 0, 0, 1, 1},
24901 {&__pyx_n_u_orthogonalize, __pyx_k_orthogonalize,
sizeof(__pyx_k_orthogonalize), 0, 1, 0, 1},
24902 {&__pyx_n_s_outlier_significance_level, __pyx_k_outlier_significance_level,
sizeof(__pyx_k_outlier_significance_level), 0, 0, 1, 1},
24903 {&__pyx_n_u_outlier_significance_level, __pyx_k_outlier_significance_level,
sizeof(__pyx_k_outlier_significance_level), 0, 1, 0, 1},
24904 {&__pyx_n_s_p, __pyx_k_p,
sizeof(__pyx_k_p), 0, 0, 1, 1},
24905 {&__pyx_n_s_pack, __pyx_k_pack,
sizeof(__pyx_k_pack), 0, 0, 1, 1},
24906 {&__pyx_n_s_perf_counter, __pyx_k_perf_counter,
sizeof(__pyx_k_perf_counter), 0, 0, 1, 1},
24907 {&__pyx_n_s_pickle, __pyx_k_pickle,
sizeof(__pyx_k_pickle), 0, 0, 1, 1},
24908 {&__pyx_n_s_plot, __pyx_k_plot,
sizeof(__pyx_k_plot), 0, 0, 1, 1},
24909 {&__pyx_n_s_plot_convergence, __pyx_k_plot_convergence,
sizeof(__pyx_k_plot_convergence), 0, 0, 1, 1},
24910 {&__pyx_n_s_print_summary, __pyx_k_print_summary,
sizeof(__pyx_k_print_summary), 0, 0, 1, 1},
24911 {&__pyx_n_s_process_time, __pyx_k_process_time,
sizeof(__pyx_k_process_time), 0, 0, 1, 1},
24912 {&__pyx_n_s_processed_samples_indices, __pyx_k_processed_samples_indices,
sizeof(__pyx_k_processed_samples_indices), 0, 0, 1, 1},
24913 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError,
sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
24914 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum,
sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
24915 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer,
sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
24916 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result,
sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
24917 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state,
sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
24918 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type,
sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
24919 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum,
sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
24920 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable,
sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
24921 {&__pyx_n_s_range, __pyx_k_range,
sizeof(__pyx_k_range), 0, 0, 1, 1},
24922 {&__pyx_n_s_reduce, __pyx_k_reduce,
sizeof(__pyx_k_reduce), 0, 0, 1, 1},
24923 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython,
sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
24924 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex,
sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
24925 {&__pyx_n_u_relative_error, __pyx_k_relative_error,
sizeof(__pyx_k_relative_error), 0, 1, 0, 1},
24926 {&__pyx_n_s_return_info, __pyx_k_return_info,
sizeof(__pyx_k_return_info), 0, 0, 1, 1},
24927 {&__pyx_n_s_rmatmul, __pyx_k_rmatmul,
sizeof(__pyx_k_rmatmul), 0, 0, 1, 1},
24928 {&__pyx_n_s_samples, __pyx_k_samples,
sizeof(__pyx_k_samples), 0, 0, 1, 1},
24929 {&__pyx_n_u_samples, __pyx_k_samples,
sizeof(__pyx_k_samples), 0, 1, 0, 1},
24930 {&__pyx_n_u_samples_mean, __pyx_k_samples_mean,
sizeof(__pyx_k_samples_mean), 0, 1, 0, 1},
24931 {&__pyx_n_u_samples_processed_order, __pyx_k_samples_processed_order,
sizeof(__pyx_k_samples_processed_order), 0, 1, 0, 1},
24932 {&__pyx_n_s_scipy, __pyx_k_scipy,
sizeof(__pyx_k_scipy), 0, 0, 1, 1},
24933 {&__pyx_n_s_scipy_sparse, __pyx_k_scipy_sparse,
sizeof(__pyx_k_scipy_sparse), 0, 0, 1, 1},
24934 {&__pyx_n_s_seed, __pyx_k_seed,
sizeof(__pyx_k_seed), 0, 0, 1, 1},
24935 {&__pyx_n_u_seed, __pyx_k_seed,
sizeof(__pyx_k_seed), 0, 1, 0, 1},
24936 {&__pyx_n_s_setstate, __pyx_k_setstate,
sizeof(__pyx_k_setstate), 0, 0, 1, 1},
24937 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython,
sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
24938 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
24939 {&__pyx_n_s_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 0, 1, 1},
24940 {&__pyx_n_u_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 1, 0, 1},
24941 {&__pyx_n_u_solver, __pyx_k_solver,
sizeof(__pyx_k_solver), 0, 1, 0, 1},
24942 {&__pyx_n_s_solver_tol, __pyx_k_solver_tol,
sizeof(__pyx_k_solver_tol), 0, 0, 1, 1},
24943 {&__pyx_n_u_solver_tol, __pyx_k_solver_tol,
sizeof(__pyx_k_solver_tol), 0, 1, 0, 1},
24944 {&__pyx_n_u_sparse, __pyx_k_sparse,
sizeof(__pyx_k_sparse), 0, 1, 0, 1},
24945 {&__pyx_n_s_square, __pyx_k_square,
sizeof(__pyx_k_square), 0, 0, 1, 1},
24946 {&__pyx_n_s_start, __pyx_k_start,
sizeof(__pyx_k_start), 0, 0, 1, 1},
24947 {&__pyx_n_s_step, __pyx_k_step,
sizeof(__pyx_k_step), 0, 0, 1, 1},
24948 {&__pyx_n_s_stop, __pyx_k_stop,
sizeof(__pyx_k_stop), 0, 0, 1, 1},
24949 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct,
sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
24950 {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect,
sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
24951 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect,
sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
24952 {&__pyx_kp_s_stringsource, __pyx_k_stringsource,
sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
24953 {&__pyx_n_s_struct, __pyx_k_struct,
sizeof(__pyx_k_struct), 0, 0, 1, 1},
24954 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
24955 {&__pyx_n_s_time, __pyx_k_time,
sizeof(__pyx_k_time), 0, 0, 1, 1},
24956 {&__pyx_n_u_time, __pyx_k_time,
sizeof(__pyx_k_time), 0, 1, 0, 1},
24957 {&__pyx_n_s_tot_wall_time, __pyx_k_tot_wall_time,
sizeof(__pyx_k_tot_wall_time), 0, 0, 1, 1},
24958 {&__pyx_n_u_tot_wall_time, __pyx_k_tot_wall_time,
sizeof(__pyx_k_tot_wall_time), 0, 1, 0, 1},
24959 {&__pyx_n_s_trace, __pyx_k_trace,
sizeof(__pyx_k_trace), 0, 0, 1, 1},
24960 {&__pyx_n_s_trace_estimator_trace_estimator, __pyx_k_trace_estimator_trace_estimator,
sizeof(__pyx_k_trace_estimator_trace_estimator), 0, 0, 1, 1},
24961 {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data,
sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
24962 {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str,
sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
24963 {&__pyx_n_s_unpack, __pyx_k_unpack,
sizeof(__pyx_k_unpack), 0, 0, 1, 1},
24964 {&__pyx_n_s_update, __pyx_k_update,
sizeof(__pyx_k_update), 0, 0, 1, 1},
24965 {&__pyx_n_s_vector_size, __pyx_k_vector_size,
sizeof(__pyx_k_vector_size), 0, 0, 1, 1},
24966 {&__pyx_n_s_verbose, __pyx_k_verbose,
sizeof(__pyx_k_verbose), 0, 0, 1, 1},
24967 {&__pyx_n_u_version, __pyx_k_version,
sizeof(__pyx_k_version), 0, 1, 0, 1},
24968 {&__pyx_n_s_version_2, __pyx_k_version_2,
sizeof(__pyx_k_version_2), 0, 0, 1, 1},
24969 {&__pyx_n_s_zeros, __pyx_k_zeros,
sizeof(__pyx_k_zeros), 0, 0, 1, 1},
24970 {0, 0, 0, 0, 0, 0, 0}
24972 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
24973 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError);
if (!__pyx_builtin_TypeError) __PYX_ERR(0, 663, __pyx_L1_error)
24974 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range);
if (!__pyx_builtin_range) __PYX_ERR(0, 801, __pyx_L1_error)
24975 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError);
if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 978, __pyx_L1_error)
24976 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError);
if (!__pyx_builtin_ValueError) __PYX_ERR(1, 134, __pyx_L1_error)
24977 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError);
if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 149, __pyx_L1_error)
24978 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate);
if (!__pyx_builtin_enumerate) __PYX_ERR(1, 152, __pyx_L1_error)
24979 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis);
if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 406, __pyx_L1_error)
24980 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id);
if (!__pyx_builtin_id) __PYX_ERR(1, 615, __pyx_L1_error)
24981 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError);
if (!__pyx_builtin_IndexError) __PYX_ERR(1, 834, __pyx_L1_error)
24987 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
24988 __Pyx_RefNannyDeclarations
24989 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
24998 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Data_type_should_be_either_float);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 663, __pyx_L1_error)
24999 __Pyx_GOTREF(__pyx_tuple__2);
25000 __Pyx_GIVEREF(__pyx_tuple__2);
25009 __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None);
if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 783, __pyx_L1_error)
25010 __Pyx_GOTREF(__pyx_slice__4);
25011 __Pyx_GIVEREF(__pyx_slice__4);
25020 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_AtA_cannot_be_None);
if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 978, __pyx_L1_error)
25021 __Pyx_GOTREF(__pyx_tuple__6);
25022 __Pyx_GIVEREF(__pyx_tuple__6);
25031 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr);
if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 134, __pyx_L1_error)
25032 __Pyx_GOTREF(__pyx_tuple__8);
25033 __Pyx_GIVEREF(__pyx_tuple__8);
25042 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 137, __pyx_L1_error)
25043 __Pyx_GOTREF(__pyx_tuple__9);
25044 __Pyx_GIVEREF(__pyx_tuple__9);
25053 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str);
if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 149, __pyx_L1_error)
25054 __Pyx_GOTREF(__pyx_tuple__10);
25055 __Pyx_GIVEREF(__pyx_tuple__10);
25064 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 177, __pyx_L1_error)
25065 __Pyx_GOTREF(__pyx_tuple__11);
25066 __Pyx_GIVEREF(__pyx_tuple__11);
25075 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is);
if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 193, __pyx_L1_error)
25076 __Pyx_GOTREF(__pyx_tuple__12);
25077 __Pyx_GIVEREF(__pyx_tuple__12);
25085 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 2, __pyx_L1_error)
25086 __Pyx_GOTREF(__pyx_tuple__13);
25087 __Pyx_GIVEREF(__pyx_tuple__13);
25094 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 4, __pyx_L1_error)
25095 __Pyx_GOTREF(__pyx_tuple__14);
25096 __Pyx_GIVEREF(__pyx_tuple__14);
25105 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor);
if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 420, __pyx_L1_error)
25106 __Pyx_GOTREF(__pyx_tuple__15);
25107 __Pyx_GIVEREF(__pyx_tuple__15);
25116 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object);
if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 497, __pyx_L1_error)
25117 __Pyx_GOTREF(__pyx_tuple__16);
25118 __Pyx_GIVEREF(__pyx_tuple__16);
25127 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi);
if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 522, __pyx_L1_error)
25128 __Pyx_GOTREF(__pyx_tuple__17);
25129 __Pyx_GIVEREF(__pyx_tuple__17);
25138 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri);
if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 572, __pyx_L1_error)
25139 __Pyx_GOTREF(__pyx_tuple__18);
25140 __Pyx_GIVEREF(__pyx_tuple__18);
25149 __pyx_tuple__19 = PyTuple_New(1);
if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 579, __pyx_L1_error)
25150 __Pyx_GOTREF(__pyx_tuple__19);
25151 __Pyx_INCREF(__pyx_int_neg_1);
25152 __Pyx_GIVEREF(__pyx_int_neg_1);
25153 PyTuple_SET_ITEM(__pyx_tuple__19, 0, __pyx_int_neg_1);
25154 __Pyx_GIVEREF(__pyx_tuple__19);
25162 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 2, __pyx_L1_error)
25163 __Pyx_GOTREF(__pyx_tuple__20);
25164 __Pyx_GIVEREF(__pyx_tuple__20);
25171 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 4, __pyx_L1_error)
25172 __Pyx_GOTREF(__pyx_tuple__21);
25173 __Pyx_GIVEREF(__pyx_tuple__21);
25182 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte);
if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 705, __pyx_L1_error)
25183 __Pyx_GOTREF(__pyx_tuple__22);
25184 __Pyx_GIVEREF(__pyx_tuple__22);
25192 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 2, __pyx_L1_error)
25193 __Pyx_GOTREF(__pyx_tuple__23);
25194 __Pyx_GIVEREF(__pyx_tuple__23);
25201 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 4, __pyx_L1_error)
25202 __Pyx_GOTREF(__pyx_tuple__24);
25203 __Pyx_GIVEREF(__pyx_tuple__24);
25204 __pyx_tuple__26 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877);
if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 4, __pyx_L1_error)
25205 __Pyx_GOTREF(__pyx_tuple__26);
25206 __Pyx_GIVEREF(__pyx_tuple__26);
25215 __pyx_tuple__27 = PyTuple_Pack(33, __pyx_n_s_A, __pyx_n_s_gram, __pyx_n_s_p, __pyx_n_s_return_info, __pyx_n_s_B, __pyx_n_s_C, __pyx_n_s_assume_matrix, __pyx_n_s_min_num_samples, __pyx_n_s_max_num_samples, __pyx_n_s_error_atol, __pyx_n_s_error_rtol, __pyx_n_s_confidence_level, __pyx_n_s_outlier_significance_level, __pyx_n_s_solver_tol, __pyx_n_s_orthogonalize, __pyx_n_s_seed, __pyx_n_s_num_threads, __pyx_n_s_verbose, __pyx_n_s_plot, __pyx_n_s_square, __pyx_n_s_data_type_name, __pyx_n_s_trace, __pyx_n_s_error, __pyx_n_s_num_outliers, __pyx_n_s_samples, __pyx_n_s_processed_samples_indices, __pyx_n_s_num_processed_samples, __pyx_n_s_num_samples_used, __pyx_n_s_converged, __pyx_n_s_tot_wall_time, __pyx_n_s_alg_wall_time, __pyx_n_s_cpu_proc_time, __pyx_n_s_info);
if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 37, __pyx_L1_error)
25216 __Pyx_GOTREF(__pyx_tuple__27);
25217 __Pyx_GIVEREF(__pyx_tuple__27);
25218 __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(19, 0, 33, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_n_s_hutchinson_method, 37, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 37, __pyx_L1_error)
25219 __pyx_tuple__28 = PyTuple_Pack(18, ((PyObject *)Py_False), ((PyObject *)__pyx_int_1), ((PyObject *)Py_False), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject*)__pyx_n_u_gen), ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_50), ((PyObject *)Py_None), ((PyObject*)__pyx_float_1eneg_2), ((PyObject*)__pyx_float_0_95), ((PyObject*)__pyx_float_0_001), ((PyObject*)__pyx_float_1eneg_6), ((PyObject *)Py_True), ((PyObject *)Py_None), ((PyObject *)__pyx_int_0), ((PyObject *)Py_False), ((PyObject *)Py_False));
if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 37, __pyx_L1_error)
25220 __Pyx_GOTREF(__pyx_tuple__28);
25221 __Pyx_GIVEREF(__pyx_tuple__28);
25230 __pyx_tuple__29 = PyTuple_Pack(36, __pyx_n_s_A, __pyx_n_s_B, __pyx_n_s_C, __pyx_n_s_gram, __pyx_n_s_p, __pyx_n_s_assume_matrix, __pyx_n_s_min_num_samples, __pyx_n_s_max_num_samples, __pyx_n_s_error_atol, __pyx_n_s_error_rtol, __pyx_n_s_confidence_level, __pyx_n_s_outlier_significance_level, __pyx_n_s_solver_tol, __pyx_n_s_orthogonalize, __pyx_n_s_seed, __pyx_n_s_num_threads, __pyx_n_s_vector_size, __pyx_n_s_E, __pyx_n_s_memoryview_E, __pyx_n_s_cE, __pyx_n_s_init_tot_wall_time, __pyx_n_s_init_cpu_proc_time, __pyx_n_s_samples, __pyx_n_s_processed_samples_indices, __pyx_n_s_num_processed_samples, __pyx_n_s_num_samples_used, __pyx_n_s_converged, __pyx_n_s_init_alg_wall_time, __pyx_n_s_AtA, __pyx_n_s_i, __pyx_n_s_alg_wall_time, __pyx_n_s_trace, __pyx_n_s_error, __pyx_n_s_num_outliers, __pyx_n_s_tot_wall_time, __pyx_n_s_cpu_proc_time);
if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 741, __pyx_L1_error)
25231 __Pyx_GOTREF(__pyx_tuple__29);
25232 __Pyx_GIVEREF(__pyx_tuple__29);
25233 __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(16, 0, 36, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_n_s_hutchinson_method_float, 741, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 741, __pyx_L1_error)
25242 __pyx_tuple__30 = PyTuple_Pack(36, __pyx_n_s_A, __pyx_n_s_B, __pyx_n_s_C, __pyx_n_s_gram, __pyx_n_s_p, __pyx_n_s_assume_matrix, __pyx_n_s_min_num_samples, __pyx_n_s_max_num_samples, __pyx_n_s_error_atol, __pyx_n_s_error_rtol, __pyx_n_s_confidence_level, __pyx_n_s_outlier_significance_level, __pyx_n_s_solver_tol, __pyx_n_s_orthogonalize, __pyx_n_s_seed, __pyx_n_s_num_threads, __pyx_n_s_vector_size, __pyx_n_s_E, __pyx_n_s_memoryview_E, __pyx_n_s_cE, __pyx_n_s_init_tot_wall_time, __pyx_n_s_init_cpu_proc_time, __pyx_n_s_samples, __pyx_n_s_processed_samples_indices, __pyx_n_s_num_processed_samples, __pyx_n_s_num_samples_used, __pyx_n_s_converged, __pyx_n_s_init_alg_wall_time, __pyx_n_s_AtA, __pyx_n_s_i, __pyx_n_s_alg_wall_time, __pyx_n_s_trace, __pyx_n_s_error, __pyx_n_s_num_outliers, __pyx_n_s_tot_wall_time, __pyx_n_s_cpu_proc_time);
if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 839, __pyx_L1_error)
25243 __Pyx_GOTREF(__pyx_tuple__30);
25244 __Pyx_GIVEREF(__pyx_tuple__30);
25245 __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(16, 0, 36, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_n_s_hutchinson_method_double, 839, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 839, __pyx_L1_error)
25254 __pyx_tuple__31 = PyTuple_Pack(12, __pyx_n_s_A, __pyx_n_s_AtA, __pyx_n_s_p, __pyx_n_s_gram, __pyx_n_s_assume_matrix, __pyx_n_s_solver_tol, __pyx_n_s_B, __pyx_n_s_E, __pyx_n_s_BE, __pyx_n_s_OpE, __pyx_n_s_i, __pyx_n_s_AinvpE);
if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1095, __pyx_L1_error)
25255 __Pyx_GOTREF(__pyx_tuple__31);
25256 __Pyx_GIVEREF(__pyx_tuple__31);
25257 __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_n_s_operator_dot, 1095, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 1095, __pyx_L1_error)
25266 __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect);
if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 287, __pyx_L1_error)
25267 __Pyx_GOTREF(__pyx_tuple__32);
25268 __Pyx_GIVEREF(__pyx_tuple__32);
25277 __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct);
if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 288, __pyx_L1_error)
25278 __Pyx_GOTREF(__pyx_tuple__33);
25279 __Pyx_GIVEREF(__pyx_tuple__33);
25288 __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect);
if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 289, __pyx_L1_error)
25289 __Pyx_GOTREF(__pyx_tuple__34);
25290 __Pyx_GIVEREF(__pyx_tuple__34);
25299 __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct);
if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 292, __pyx_L1_error)
25300 __Pyx_GOTREF(__pyx_tuple__35);
25301 __Pyx_GIVEREF(__pyx_tuple__35);
25310 __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect);
if (unlikely(!__pyx_tuple__36)) __PYX_ERR(1, 293, __pyx_L1_error)
25311 __Pyx_GOTREF(__pyx_tuple__36);
25312 __Pyx_GIVEREF(__pyx_tuple__36);
25319 __pyx_tuple__37 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result);
if (unlikely(!__pyx_tuple__37)) __PYX_ERR(1, 1, __pyx_L1_error)
25320 __Pyx_GOTREF(__pyx_tuple__37);
25321 __Pyx_GIVEREF(__pyx_tuple__37);
25322 __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(1, 1, __pyx_L1_error)
25323 __Pyx_RefNannyFinishContext();
25326 __Pyx_RefNannyFinishContext();
25330 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
25332 __Pyx_init_assertions_enabled();
25334 if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
25336 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25337 __pyx_float_0_95 = PyFloat_FromDouble(0.95);
if (unlikely(!__pyx_float_0_95)) __PYX_ERR(0, 1, __pyx_L1_error)
25338 __pyx_float_1eneg_2 = PyFloat_FromDouble(1e-2);
if (unlikely(!__pyx_float_1eneg_2)) __PYX_ERR(0, 1, __pyx_L1_error)
25339 __pyx_float_1eneg_6 = PyFloat_FromDouble(1e-6);
if (unlikely(!__pyx_float_1eneg_6)) __PYX_ERR(0, 1, __pyx_L1_error)
25340 __pyx_float_0_001 = PyFloat_FromDouble(0.001);
if (unlikely(!__pyx_float_0_001)) __PYX_ERR(0, 1, __pyx_L1_error)
25341 __pyx_int_0 = PyInt_FromLong(0);
if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
25342 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
25343 __pyx_int_10 = PyInt_FromLong(10);
if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
25344 __pyx_int_50 = PyInt_FromLong(50);
if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error)
25345 __pyx_int_112105877 = PyInt_FromLong(112105877L);
if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error)
25346 __pyx_int_136983863 = PyInt_FromLong(136983863L);
if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error)
25347 __pyx_int_184977713 = PyInt_FromLong(184977713L);
if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
25348 __pyx_int_neg_1 = PyInt_FromLong(-1);
if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
25354 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
25355 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
25356 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
25357 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
25358 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
25359 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
25360 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
25362 static int __Pyx_modinit_global_init_code(
void) {
25363 __Pyx_RefNannyDeclarations
25364 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
25366 generic = Py_None; Py_INCREF(Py_None);
25367 strided = Py_None; Py_INCREF(Py_None);
25368 indirect = Py_None; Py_INCREF(Py_None);
25369 contiguous = Py_None; Py_INCREF(Py_None);
25370 indirect_contiguous = Py_None; Py_INCREF(Py_None);
25371 __Pyx_RefNannyFinishContext();
25375 static int __Pyx_modinit_variable_export_code(
void) {
25376 __Pyx_RefNannyDeclarations
25377 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
25379 __Pyx_RefNannyFinishContext();
25383 static int __Pyx_modinit_function_export_code(
void) {
25384 __Pyx_RefNannyDeclarations
25385 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
25387 __Pyx_RefNannyFinishContext();
25391 static int __Pyx_modinit_type_init_code(
void) {
25392 __Pyx_RefNannyDeclarations
25393 int __pyx_lineno = 0;
25394 const char *__pyx_filename = NULL;
25395 int __pyx_clineno = 0;
25396 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
25398 __pyx_vtabptr_array = &__pyx_vtable_array;
25399 __pyx_vtable_array.get_memview = (PyObject *(*)(
struct __pyx_array_obj *))__pyx_array_get_memview;
25400 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 106, __pyx_L1_error)
25401 #if PY_VERSION_HEX < 0x030800B1
25402 __pyx_type___pyx_array.tp_print = 0;
25404 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 106, __pyx_L1_error)
25405 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 106, __pyx_L1_error)
25406 __pyx_array_type = &__pyx_type___pyx_array;
25407 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 280, __pyx_L1_error)
25408 #if PY_VERSION_HEX < 0x030800B1
25409 __pyx_type___pyx_MemviewEnum.tp_print = 0;
25411 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
25412 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
25414 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 280, __pyx_L1_error)
25415 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
25416 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
25417 __pyx_vtable_memoryview.get_item_pointer = (
char *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
25418 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
25419 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
25420 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
25421 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
25422 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryview_convert_item_to_object;
25423 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryview_assign_item_from_object;
25424 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 331, __pyx_L1_error)
25425 #if PY_VERSION_HEX < 0x030800B1
25426 __pyx_type___pyx_memoryview.tp_print = 0;
25428 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
25429 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
25431 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 331, __pyx_L1_error)
25432 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 331, __pyx_L1_error)
25433 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
25434 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
25435 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
25436 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryviewslice_convert_item_to_object;
25437 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
25438 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
25439 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 967, __pyx_L1_error)
25440 #if PY_VERSION_HEX < 0x030800B1
25441 __pyx_type___pyx_memoryviewslice.tp_print = 0;
25443 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
25444 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
25446 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 967, __pyx_L1_error)
25447 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 967, __pyx_L1_error)
25448 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
25449 __Pyx_RefNannyFinishContext();
25452 __Pyx_RefNannyFinishContext();
25456 static int __Pyx_modinit_type_import_code(
void) {
25457 __Pyx_RefNannyDeclarations
25458 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
25460 __Pyx_RefNannyFinishContext();
25464 static int __Pyx_modinit_variable_import_code(
void) {
25465 __Pyx_RefNannyDeclarations
25466 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
25468 __Pyx_RefNannyFinishContext();
25472 static int __Pyx_modinit_function_import_code(
void) {
25473 __Pyx_RefNannyDeclarations
25474 PyObject *__pyx_t_1 = NULL;
25475 int __pyx_lineno = 0;
25476 const char *__pyx_filename = NULL;
25477 int __pyx_clineno = 0;
25478 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
25480 __pyx_t_1 = PyImport_ImportModule(
"imate._linear_algebra.orthogonalization");
if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
25481 __Pyx_GOTREF(__pyx_t_1);
25482 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"__pyx_fuse_0orthogonalize_vectors", (
void (**)(
void))&__pyx_fuse_0__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors,
"void (float *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25483 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"__pyx_fuse_1orthogonalize_vectors", (
void (**)(
void))&__pyx_fuse_1__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors,
"void (double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25484 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"__pyx_fuse_2orthogonalize_vectors", (
void (**)(
void))&__pyx_fuse_2__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors,
"void (long double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25485 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25486 __pyx_t_1 = PyImport_ImportModule(
"imate._linear_algebra.random_vectors");
if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
25487 __Pyx_GOTREF(__pyx_t_1);
25488 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"__pyx_fuse_0generate_random_column_vectors", (
void (**)(
void))&__pyx_fuse_0__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors,
"void (float *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25489 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"__pyx_fuse_1generate_random_column_vectors", (
void (**)(
void))&__pyx_fuse_1__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors,
"void (double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25490 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"__pyx_fuse_2generate_random_column_vectors", (
void (**)(
void))&__pyx_fuse_2__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors,
"void (long double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25491 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25492 __Pyx_RefNannyFinishContext();
25495 __Pyx_XDECREF(__pyx_t_1);
25496 __Pyx_RefNannyFinishContext();
25501 #ifndef CYTHON_NO_PYINIT_EXPORT
25502 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
25503 #elif PY_MAJOR_VERSION < 3
25505 #define __Pyx_PyMODINIT_FUNC extern "C" void
25507 #define __Pyx_PyMODINIT_FUNC void
25511 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
25513 #define __Pyx_PyMODINIT_FUNC PyObject *
25518 #if PY_MAJOR_VERSION < 3
25519 __Pyx_PyMODINIT_FUNC init_hutchinson_method(
void) CYTHON_SMALL_CODE;
25520 __Pyx_PyMODINIT_FUNC init_hutchinson_method(
void)
25522 __Pyx_PyMODINIT_FUNC PyInit__hutchinson_method(
void) CYTHON_SMALL_CODE;
25523 __Pyx_PyMODINIT_FUNC PyInit__hutchinson_method(
void)
25524 #if CYTHON_PEP489_MULTI_PHASE_INIT
25526 return PyModuleDef_Init(&__pyx_moduledef);
25528 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
25529 #if PY_VERSION_HEX >= 0x030700A1
25530 static PY_INT64_T main_interpreter_id = -1;
25531 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
25532 if (main_interpreter_id == -1) {
25533 main_interpreter_id = current_id;
25534 return (unlikely(current_id == -1)) ? -1 : 0;
25535 }
else if (unlikely(main_interpreter_id != current_id))
25537 static PyInterpreterState *main_interpreter = NULL;
25538 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
25539 if (!main_interpreter) {
25540 main_interpreter = current_interpreter;
25541 }
else if (unlikely(main_interpreter != current_interpreter))
25546 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
25551 static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict,
const char* from_name,
const char* to_name,
int allow_none) {
25552 PyObject *value = PyObject_GetAttrString(spec, from_name);
25554 if (likely(value)) {
25555 if (allow_none || value != Py_None) {
25556 result = PyDict_SetItemString(moddict, to_name, value);
25559 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
25566 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
25567 PyObject *module = NULL, *moddict, *modname;
25568 if (__Pyx_check_single_interpreter())
25571 return __Pyx_NewRef(__pyx_m);
25572 modname = PyObject_GetAttrString(spec,
"name");
25573 if (unlikely(!modname))
goto bad;
25574 module = PyModule_NewObject(modname);
25575 Py_DECREF(modname);
25576 if (unlikely(!module))
goto bad;
25577 moddict = PyModule_GetDict(module);
25578 if (unlikely(!moddict))
goto bad;
25579 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
25580 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
25581 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
25582 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
25585 Py_XDECREF(module);
25590 static CYTHON_SMALL_CODE
int __pyx_pymod_exec__hutchinson_method(PyObject *__pyx_pyinit_module)
25594 __Pyx_TraceDeclarations
25595 PyObject *__pyx_t_1 = NULL;
25596 PyObject *__pyx_t_2 = NULL;
25597 static PyThread_type_lock __pyx_t_3[8];
25598 int __pyx_lineno = 0;
25599 const char *__pyx_filename = NULL;
25600 int __pyx_clineno = 0;
25601 __Pyx_RefNannyDeclarations
25602 #if CYTHON_PEP489_MULTI_PHASE_INIT
25604 if (__pyx_m == __pyx_pyinit_module)
return 0;
25605 PyErr_SetString(PyExc_RuntimeError,
"Module '_hutchinson_method' has already been imported. Re-initialisation is not supported.");
25608 #elif PY_MAJOR_VERSION >= 3
25609 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
25611 #if CYTHON_REFNANNY
25612 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
25613 if (!__Pyx_RefNanny) {
25615 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
25616 if (!__Pyx_RefNanny)
25617 Py_FatalError(
"failed to import 'refnanny' module");
25620 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit__hutchinson_method(void)", 0);
25621 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25622 #ifdef __Pxy_PyFrame_Initialize_Offsets
25623 __Pxy_PyFrame_Initialize_Offsets();
25625 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
25626 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
25627 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
25628 #ifdef __Pyx_CyFunction_USED
25629 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25631 #ifdef __Pyx_FusedFunction_USED
25632 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25634 #ifdef __Pyx_Coroutine_USED
25635 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25637 #ifdef __Pyx_Generator_USED
25638 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25640 #ifdef __Pyx_AsyncGen_USED
25641 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25643 #ifdef __Pyx_StopAsyncIteration_USED
25644 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25648 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
25649 PyEval_InitThreads();
25652 #if CYTHON_PEP489_MULTI_PHASE_INIT
25653 __pyx_m = __pyx_pyinit_module;
25654 Py_INCREF(__pyx_m);
25656 #if PY_MAJOR_VERSION < 3
25657 __pyx_m = Py_InitModule4(
"_hutchinson_method", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
25659 __pyx_m = PyModule_Create(&__pyx_moduledef);
25661 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
25663 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
25664 Py_INCREF(__pyx_d);
25665 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
25666 Py_INCREF(__pyx_b);
25667 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
25668 Py_INCREF(__pyx_cython_runtime);
25669 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25671 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25672 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
25673 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25675 if (__pyx_module_is_main_imate__traceinv___hutchinson_method) {
25676 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25678 #if PY_MAJOR_VERSION >= 3
25680 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
25681 if (!PyDict_GetItemString(modules,
"imate.traceinv._hutchinson_method")) {
25682 if (unlikely(PyDict_SetItemString(modules,
"imate.traceinv._hutchinson_method", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
25687 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25689 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25691 (void)__Pyx_modinit_global_init_code();
25692 (void)__Pyx_modinit_variable_export_code();
25693 (void)__Pyx_modinit_function_export_code();
25694 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
25695 (void)__Pyx_modinit_type_import_code();
25696 (void)__Pyx_modinit_variable_import_code();
25697 if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
25699 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
25700 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25702 __Pyx_TraceCall(
"__Pyx_PyMODINIT_FUNC PyInit__hutchinson_method(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
25711 __Pyx_TraceLine(15,0,__PYX_ERR(0, 15, __pyx_L1_error))
25712 __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
25713 __Pyx_GOTREF(__pyx_t_1);
25714 if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
25715 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25724 __Pyx_TraceLine(16,0,__PYX_ERR(0, 16, __pyx_L1_error))
25725 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
25726 __Pyx_GOTREF(__pyx_t_1);
25727 if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
25728 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25737 __Pyx_TraceLine(17,0,__PYX_ERR(0, 17, __pyx_L1_error))
25738 __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy_sparse, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
25739 __Pyx_GOTREF(__pyx_t_1);
25740 if (PyDict_SetItem(__pyx_d, __pyx_n_s_scipy, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
25741 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25750 __Pyx_TraceLine(18,0,__PYX_ERR(0, 18, __pyx_L1_error))
25751 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
25752 __Pyx_GOTREF(__pyx_t_1);
25753 __Pyx_INCREF(__pyx_n_s_isspmatrix);
25754 __Pyx_GIVEREF(__pyx_n_s_isspmatrix);
25755 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_isspmatrix);
25756 __pyx_t_2 = __Pyx_Import(__pyx_n_s_scipy_sparse, __pyx_t_1, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
25757 __Pyx_GOTREF(__pyx_t_2);
25758 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25759 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_isspmatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
25760 __Pyx_GOTREF(__pyx_t_1);
25761 if (PyDict_SetItem(__pyx_d, __pyx_n_s_isspmatrix, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
25762 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25763 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25772 __Pyx_TraceLine(19,0,__PYX_ERR(0, 19, __pyx_L1_error))
25773 __pyx_t_2 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
25774 __Pyx_GOTREF(__pyx_t_2);
25775 if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiprocessing, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
25776 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25785 __Pyx_TraceLine(20,0,__PYX_ERR(0, 20, __pyx_L1_error))
25786 __pyx_t_2 = PyList_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
25787 __Pyx_GOTREF(__pyx_t_2);
25788 __Pyx_INCREF(__pyx_n_s_version_2);
25789 __Pyx_GIVEREF(__pyx_n_s_version_2);
25790 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_version_2);
25791 __pyx_t_1 = __Pyx_Import(__pyx_n_s_version_2, __pyx_t_2, 2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
25792 __Pyx_GOTREF(__pyx_t_1);
25793 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25794 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_version_2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
25795 __Pyx_GOTREF(__pyx_t_2);
25796 if (PyDict_SetItem(__pyx_d, __pyx_n_s_version_2, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
25797 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25798 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25807 __Pyx_TraceLine(21,0,__PYX_ERR(0, 21, __pyx_L1_error))
25808 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
25809 __Pyx_GOTREF(__pyx_t_1);
25810 __Pyx_INCREF(__pyx_n_s_linear_solver);
25811 __Pyx_GIVEREF(__pyx_n_s_linear_solver);
25812 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_linear_solver);
25813 __pyx_t_2 = __Pyx_Import(__pyx_n_s_linear_algebra, __pyx_t_1, 2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
25814 __Pyx_GOTREF(__pyx_t_2);
25815 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25816 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_linear_solver);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
25817 __Pyx_GOTREF(__pyx_t_1);
25818 if (PyDict_SetItem(__pyx_d, __pyx_n_s_linear_solver, __pyx_t_1) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
25819 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25820 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25829 __Pyx_TraceLine(22,0,__PYX_ERR(0, 22, __pyx_L1_error))
25830 __pyx_t_2 = PyList_New(2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
25831 __Pyx_GOTREF(__pyx_t_2);
25832 __Pyx_INCREF(__pyx_n_s_check_convergence);
25833 __Pyx_GIVEREF(__pyx_n_s_check_convergence);
25834 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_check_convergence);
25835 __Pyx_INCREF(__pyx_n_s_average_estimates);
25836 __Pyx_GIVEREF(__pyx_n_s_average_estimates);
25837 PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_average_estimates);
25838 __pyx_t_1 = __Pyx_Import(__pyx_n_s_convergence_tools, __pyx_t_2, 1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
25839 __Pyx_GOTREF(__pyx_t_1);
25840 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25841 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_check_convergence);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
25842 __Pyx_GOTREF(__pyx_t_2);
25843 if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_convergence, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
25844 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25845 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_average_estimates);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
25846 __Pyx_GOTREF(__pyx_t_2);
25847 if (PyDict_SetItem(__pyx_d, __pyx_n_s_average_estimates, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
25848 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25849 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25858 __Pyx_TraceLine(23,0,__PYX_ERR(0, 23, __pyx_L1_error))
25859 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
25860 __Pyx_GOTREF(__pyx_t_1);
25861 __Pyx_INCREF(__pyx_n_s_plot_convergence);
25862 __Pyx_GIVEREF(__pyx_n_s_plot_convergence);
25863 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_plot_convergence);
25864 __pyx_t_2 = __Pyx_Import(__pyx_n_s_trace_estimator_trace_estimator, __pyx_t_1, 2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
25865 __Pyx_GOTREF(__pyx_t_2);
25866 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25867 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_plot_convergence);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
25868 __Pyx_GOTREF(__pyx_t_1);
25869 if (PyDict_SetItem(__pyx_d, __pyx_n_s_plot_convergence, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
25870 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25871 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25880 __Pyx_TraceLine(24,0,__PYX_ERR(0, 24, __pyx_L1_error))
25881 __pyx_t_2 = PyList_New(2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
25882 __Pyx_GOTREF(__pyx_t_2);
25883 __Pyx_INCREF(__pyx_n_s_check_arguments);
25884 __Pyx_GIVEREF(__pyx_n_s_check_arguments);
25885 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_check_arguments);
25886 __Pyx_INCREF(__pyx_n_s_print_summary);
25887 __Pyx_GIVEREF(__pyx_n_s_print_summary);
25888 PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_print_summary);
25889 __pyx_t_1 = __Pyx_Import(__pyx_n_s_hutchinson_method_utilities, __pyx_t_2, 1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
25890 __Pyx_GOTREF(__pyx_t_1);
25891 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25892 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_check_arguments);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
25893 __Pyx_GOTREF(__pyx_t_2);
25894 if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_arguments, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
25895 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25896 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_print_summary);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
25897 __Pyx_GOTREF(__pyx_t_2);
25898 if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_summary, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
25899 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25900 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25909 __Pyx_TraceLine(25,0,__PYX_ERR(0, 25, __pyx_L1_error))
25910 __pyx_t_1 = PyList_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
25911 __Pyx_GOTREF(__pyx_t_1);
25912 __Pyx_INCREF(__pyx_n_s_get_data_type_name);
25913 __Pyx_GIVEREF(__pyx_n_s_get_data_type_name);
25914 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_data_type_name);
25915 __Pyx_INCREF(__pyx_n_s_get_nnz);
25916 __Pyx_GIVEREF(__pyx_n_s_get_nnz);
25917 PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_get_nnz);
25918 __Pyx_INCREF(__pyx_n_s_get_density);
25919 __Pyx_GIVEREF(__pyx_n_s_get_density);
25920 PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_get_density);
25921 __pyx_t_2 = __Pyx_Import(__pyx_n_s_linear_algebra_matrix_utilities, __pyx_t_1, 2);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
25922 __Pyx_GOTREF(__pyx_t_2);
25923 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25924 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_data_type_name);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
25925 __Pyx_GOTREF(__pyx_t_1);
25926 if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_data_type_name, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
25927 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25928 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_nnz);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
25929 __Pyx_GOTREF(__pyx_t_1);
25930 if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nnz, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
25931 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25932 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_density);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
25933 __Pyx_GOTREF(__pyx_t_1);
25934 if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_density, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
25935 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25936 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25945 __Pyx_TraceLine(37,0,__PYX_ERR(0, 37, __pyx_L1_error))
25946 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_8traceinv_18_hutchinson_method_1hutchinson_method, 0, __pyx_n_s_hutchinson_method, NULL, __pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_d, ((PyObject *)__pyx_codeobj_));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
25947 __Pyx_GOTREF(__pyx_t_2);
25948 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__28);
25949 if (PyDict_SetItem(__pyx_d, __pyx_n_s_hutchinson_method, __pyx_t_2) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
25950 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25959 __Pyx_TraceLine(741,0,__PYX_ERR(0, 741, __pyx_L1_error))
25960 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float, 0, __pyx_n_s_hutchinson_method_float, NULL, __pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_d, ((PyObject *)__pyx_codeobj__3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
25961 __Pyx_GOTREF(__pyx_t_2);
25962 if (PyDict_SetItem(__pyx_d, __pyx_n_s_hutchinson_method_float, __pyx_t_2) < 0) __PYX_ERR(0, 741, __pyx_L1_error)
25963 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25972 __Pyx_TraceLine(839,0,__PYX_ERR(0, 839, __pyx_L1_error))
25973 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double, 0, __pyx_n_s_hutchinson_method_double, NULL, __pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_d, ((PyObject *)__pyx_codeobj__5));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 839, __pyx_L1_error)
25974 __Pyx_GOTREF(__pyx_t_2);
25975 if (PyDict_SetItem(__pyx_d, __pyx_n_s_hutchinson_method_double, __pyx_t_2) < 0) __PYX_ERR(0, 839, __pyx_L1_error)
25976 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25985 __Pyx_TraceLine(937,0,__PYX_ERR(0, 937, __pyx_L1_error))
25995 __Pyx_TraceLine(1016,0,__PYX_ERR(0, 1016, __pyx_L1_error))
26005 __Pyx_TraceLine(1095,0,__PYX_ERR(0, 1095, __pyx_L1_error))
26006 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_8traceinv_18_hutchinson_method_7_operator_dot, 0, __pyx_n_s_operator_dot, NULL, __pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_d, ((PyObject *)__pyx_codeobj__7));
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1095, __pyx_L1_error)
26007 __Pyx_GOTREF(__pyx_t_2);
26008 if (PyDict_SetItem(__pyx_d, __pyx_n_s_operator_dot, __pyx_t_2) < 0) __PYX_ERR(0, 1095, __pyx_L1_error)
26009 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26016 __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
26017 __pyx_t_2 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
26018 __Pyx_GOTREF(__pyx_t_2);
26019 if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_hutchinson_method_line_37, __pyx_kp_u_Trace_of_matrix_or_linear_opera) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
26020 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
26021 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26030 __Pyx_TraceLine(210,0,__PYX_ERR(1, 210, __pyx_L1_error))
26031 __pyx_t_2 = __pyx_capsule_create(((
void *)(&__pyx_array_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 210, __pyx_L1_error)
26032 __Pyx_GOTREF(__pyx_t_2);
26033 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 210, __pyx_L1_error)
26034 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26035 PyType_Modified(__pyx_array_type);
26044 __Pyx_TraceLine(227,0,__PYX_ERR(1, 227, __pyx_L1_error))
26054 __Pyx_TraceLine(245,0,__PYX_ERR(1, 245, __pyx_L1_error))
26064 __Pyx_TraceLine(287,0,__PYX_ERR(1, 287, __pyx_L1_error))
26065 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__32, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 287, __pyx_L1_error)
26066 __Pyx_GOTREF(__pyx_t_2);
26067 __Pyx_XGOTREF(
generic);
26068 __Pyx_DECREF_SET(
generic, __pyx_t_2);
26069 __Pyx_GIVEREF(__pyx_t_2);
26079 __Pyx_TraceLine(288,0,__PYX_ERR(1, 288, __pyx_L1_error))
26080 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__33, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 288, __pyx_L1_error)
26081 __Pyx_GOTREF(__pyx_t_2);
26082 __Pyx_XGOTREF(strided);
26083 __Pyx_DECREF_SET(strided, __pyx_t_2);
26084 __Pyx_GIVEREF(__pyx_t_2);
26094 __Pyx_TraceLine(289,0,__PYX_ERR(1, 289, __pyx_L1_error))
26095 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__34, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 289, __pyx_L1_error)
26096 __Pyx_GOTREF(__pyx_t_2);
26097 __Pyx_XGOTREF(indirect);
26098 __Pyx_DECREF_SET(indirect, __pyx_t_2);
26099 __Pyx_GIVEREF(__pyx_t_2);
26109 __Pyx_TraceLine(292,0,__PYX_ERR(1, 292, __pyx_L1_error))
26110 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__35, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 292, __pyx_L1_error)
26111 __Pyx_GOTREF(__pyx_t_2);
26112 __Pyx_XGOTREF(contiguous);
26113 __Pyx_DECREF_SET(contiguous, __pyx_t_2);
26114 __Pyx_GIVEREF(__pyx_t_2);
26124 __Pyx_TraceLine(293,0,__PYX_ERR(1, 293, __pyx_L1_error))
26125 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__36, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 293, __pyx_L1_error)
26126 __Pyx_GOTREF(__pyx_t_2);
26127 __Pyx_XGOTREF(indirect_contiguous);
26128 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2);
26129 __Pyx_GIVEREF(__pyx_t_2);
26139 __Pyx_TraceLine(299,0,__PYX_ERR(1, 299, __pyx_L1_error))
26149 __Pyx_TraceLine(317,0,__PYX_ERR(1, 317, __pyx_L1_error))
26150 __pyx_memoryview_thread_locks_used = 0;
26159 __Pyx_TraceLine(318,0,__PYX_ERR(1, 318, __pyx_L1_error))
26160 __pyx_t_3[0] = PyThread_allocate_lock();
26161 __pyx_t_3[1] = PyThread_allocate_lock();
26162 __pyx_t_3[2] = PyThread_allocate_lock();
26163 __pyx_t_3[3] = PyThread_allocate_lock();
26164 __pyx_t_3[4] = PyThread_allocate_lock();
26165 __pyx_t_3[5] = PyThread_allocate_lock();
26166 __pyx_t_3[6] = PyThread_allocate_lock();
26167 __pyx_t_3[7] = PyThread_allocate_lock();
26168 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3,
sizeof(__pyx_memoryview_thread_locks[0]) * (8));
26177 __Pyx_TraceLine(395,0,__PYX_ERR(1, 395, __pyx_L1_error))
26187 __Pyx_TraceLine(433,0,__PYX_ERR(1, 433, __pyx_L1_error))
26197 __Pyx_TraceLine(443,0,__PYX_ERR(1, 443, __pyx_L1_error))
26207 __Pyx_TraceLine(451,0,__PYX_ERR(1, 451, __pyx_L1_error))
26217 __Pyx_TraceLine(483,0,__PYX_ERR(1, 483, __pyx_L1_error))
26227 __Pyx_TraceLine(487,0,__PYX_ERR(1, 487, __pyx_L1_error))
26237 __Pyx_TraceLine(503,0,__PYX_ERR(1, 503, __pyx_L1_error))
26247 __Pyx_TraceLine(551,0,__PYX_ERR(1, 551, __pyx_L1_error))
26248 __pyx_t_2 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 551, __pyx_L1_error)
26249 __Pyx_GOTREF(__pyx_t_2);
26250 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 551, __pyx_L1_error)
26251 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26252 PyType_Modified(__pyx_memoryview_type);
26261 __Pyx_TraceLine(659,0,__PYX_ERR(1, 659, __pyx_L1_error))
26271 __Pyx_TraceLine(665,0,__PYX_ERR(1, 665, __pyx_L1_error))
26281 __Pyx_TraceLine(668,0,__PYX_ERR(1, 668, __pyx_L1_error))
26291 __Pyx_TraceLine(702,0,__PYX_ERR(1, 702, __pyx_L1_error))
26301 __Pyx_TraceLine(712,0,__PYX_ERR(1, 712, __pyx_L1_error))
26311 __Pyx_TraceLine(809,0,__PYX_ERR(1, 809, __pyx_L1_error))
26321 __Pyx_TraceLine(912,0,__PYX_ERR(1, 912, __pyx_L1_error))
26331 __Pyx_TraceLine(945,0,__PYX_ERR(1, 945, __pyx_L1_error))
26341 __Pyx_TraceLine(981,0,__PYX_ERR(1, 981, __pyx_L1_error))
26351 __Pyx_TraceLine(987,0,__PYX_ERR(1, 987, __pyx_L1_error))
26361 __Pyx_TraceLine(997,0,__PYX_ERR(1, 997, __pyx_L1_error))
26362 __pyx_t_2 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 997, __pyx_L1_error)
26363 __Pyx_GOTREF(__pyx_t_2);
26364 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 997, __pyx_L1_error)
26365 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26366 PyType_Modified(__pyx_memoryviewslice_type);
26375 __Pyx_TraceLine(1001,0,__PYX_ERR(1, 1001, __pyx_L1_error))
26385 __Pyx_TraceLine(1054,0,__PYX_ERR(1, 1054, __pyx_L1_error))
26395 __Pyx_TraceLine(1065,0,__PYX_ERR(1, 1065, __pyx_L1_error))
26405 __Pyx_TraceLine(1082,0,__PYX_ERR(1, 1082, __pyx_L1_error))
26415 __Pyx_TraceLine(1089,0,__PYX_ERR(1, 1089, __pyx_L1_error))
26425 __Pyx_TraceLine(1111,0,__PYX_ERR(1, 1111, __pyx_L1_error))
26435 __Pyx_TraceLine(1118,0,__PYX_ERR(1, 1118, __pyx_L1_error))
26445 __Pyx_TraceLine(1172,0,__PYX_ERR(1, 1172, __pyx_L1_error))
26455 __Pyx_TraceLine(1179,0,__PYX_ERR(1, 1179, __pyx_L1_error))
26465 __Pyx_TraceLine(1189,0,__PYX_ERR(1, 1189, __pyx_L1_error))
26475 __Pyx_TraceLine(1210,0,__PYX_ERR(1, 1210, __pyx_L1_error))
26485 __Pyx_TraceLine(1253,0,__PYX_ERR(1, 1253, __pyx_L1_error))
26495 __Pyx_TraceLine(1259,0,__PYX_ERR(1, 1259, __pyx_L1_error))
26505 __Pyx_TraceLine(1263,0,__PYX_ERR(1, 1263, __pyx_L1_error))
26515 __Pyx_TraceLine(1270,0,__PYX_ERR(1, 1270, __pyx_L1_error))
26525 __Pyx_TraceLine(1342,0,__PYX_ERR(1, 1342, __pyx_L1_error))
26535 __Pyx_TraceLine(1364,0,__PYX_ERR(1, 1364, __pyx_L1_error))
26545 __Pyx_TraceLine(1373,0,__PYX_ERR(1, 1373, __pyx_L1_error))
26555 __Pyx_TraceLine(1379,0,__PYX_ERR(1, 1379, __pyx_L1_error))
26565 __Pyx_TraceLine(1399,0,__PYX_ERR(1, 1399, __pyx_L1_error))
26575 __Pyx_TraceLine(1409,0,__PYX_ERR(1, 1409, __pyx_L1_error))
26583 __Pyx_TraceLine(1,0,__PYX_ERR(1, 1, __pyx_L1_error))
26584 __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
26585 __Pyx_GOTREF(__pyx_t_2);
26586 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
26587 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26596 __Pyx_TraceLine(11,0,__PYX_ERR(1, 11, __pyx_L1_error))
26598 __Pyx_TraceReturn(Py_None, 0);
26604 __Pyx_XDECREF(__pyx_t_1);
26605 __Pyx_XDECREF(__pyx_t_2);
26608 __Pyx_AddTraceback(
"init imate.traceinv._hutchinson_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
26611 }
else if (!PyErr_Occurred()) {
26612 PyErr_SetString(PyExc_ImportError,
"init imate.traceinv._hutchinson_method");
26615 __Pyx_RefNannyFinishContext();
26616 #if CYTHON_PEP489_MULTI_PHASE_INIT
26617 return (__pyx_m != NULL) ? 0 : -1;
26618 #elif PY_MAJOR_VERSION >= 3
26627 #if CYTHON_REFNANNY
26628 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
26629 PyObject *m = NULL, *p = NULL;
26631 m = PyImport_ImportModule(modname);
26633 p = PyObject_GetAttrString(m,
"RefNannyAPI");
26635 r = PyLong_AsVoidPtr(p);
26639 return (__Pyx_RefNannyAPIStruct *)r;
26644 #if CYTHON_USE_TYPE_SLOTS
26645 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
26646 PyTypeObject* tp = Py_TYPE(obj);
26647 if (likely(tp->tp_getattro))
26648 return tp->tp_getattro(obj, attr_name);
26649 #if PY_MAJOR_VERSION < 3
26650 if (likely(tp->tp_getattr))
26651 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
26653 return PyObject_GetAttr(obj, attr_name);
26658 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
26659 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
26660 if (unlikely(!result)) {
26661 PyErr_Format(PyExc_NameError,
26662 #
if PY_MAJOR_VERSION >= 3
26663 "name '%U' is not defined", name);
26665 "name '%.200s' is not defined", PyString_AS_STRING(name));
26672 static void __Pyx_RaiseDoubleKeywordsError(
26673 const char* func_name,
26676 PyErr_Format(PyExc_TypeError,
26677 #
if PY_MAJOR_VERSION >= 3
26678 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
26680 "%s() got multiple values for keyword argument '%s'", func_name,
26681 PyString_AsString(kw_name));
26686 static int __Pyx_ParseOptionalKeywords(
26688 PyObject **argnames[],
26690 PyObject *values[],
26691 Py_ssize_t num_pos_args,
26692 const char* function_name)
26694 PyObject *key = 0, *value = 0;
26695 Py_ssize_t pos = 0;
26697 PyObject*** first_kw_arg = argnames + num_pos_args;
26698 while (PyDict_Next(kwds, &pos, &key, &value)) {
26699 name = first_kw_arg;
26700 while (*name && (**name != key)) name++;
26702 values[name-argnames] = value;
26705 name = first_kw_arg;
26706 #if PY_MAJOR_VERSION < 3
26707 if (likely(PyString_Check(key))) {
26709 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
26710 && _PyString_Eq(**name, key)) {
26711 values[name-argnames] = value;
26716 if (*name)
continue;
26718 PyObject*** argname = argnames;
26719 while (argname != first_kw_arg) {
26720 if ((**argname == key) || (
26721 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
26722 && _PyString_Eq(**argname, key))) {
26723 goto arg_passed_twice;
26730 if (likely(PyUnicode_Check(key))) {
26732 int cmp = (**name == key) ? 0 :
26733 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
26734 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
26736 PyUnicode_Compare(**name, key);
26737 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
26739 values[name-argnames] = value;
26744 if (*name)
continue;
26746 PyObject*** argname = argnames;
26747 while (argname != first_kw_arg) {
26748 int cmp = (**argname == key) ? 0 :
26749 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
26750 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
26752 PyUnicode_Compare(**argname, key);
26753 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
26754 if (cmp == 0)
goto arg_passed_twice;
26759 goto invalid_keyword_type;
26761 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
26763 goto invalid_keyword;
26768 __Pyx_RaiseDoubleKeywordsError(function_name, key);
26770 invalid_keyword_type:
26771 PyErr_Format(PyExc_TypeError,
26772 "%.200s() keywords must be strings", function_name);
26775 PyErr_Format(PyExc_TypeError,
26776 #
if PY_MAJOR_VERSION < 3
26777 "%.200s() got an unexpected keyword argument '%.200s'",
26778 function_name, PyString_AsString(key));
26780 "%s() got an unexpected keyword argument '%U'",
26781 function_name, key);
26788 static void __Pyx_RaiseArgtupleInvalid(
26789 const char* func_name,
26791 Py_ssize_t num_min,
26792 Py_ssize_t num_max,
26793 Py_ssize_t num_found)
26795 Py_ssize_t num_expected;
26796 const char *more_or_less;
26797 if (num_found < num_min) {
26798 num_expected = num_min;
26799 more_or_less =
"at least";
26801 num_expected = num_max;
26802 more_or_less =
"at most";
26805 more_or_less =
"exactly";
26807 PyErr_Format(PyExc_TypeError,
26808 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
26809 func_name, more_or_less, num_expected,
26810 (num_expected == 1) ?
"" :
"s", num_found);
26814 #if CYTHON_FAST_THREAD_STATE
26815 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
26816 PyObject *tmp_type, *tmp_value, *tmp_tb;
26817 tmp_type = tstate->curexc_type;
26818 tmp_value = tstate->curexc_value;
26819 tmp_tb = tstate->curexc_traceback;
26820 tstate->curexc_type = type;
26821 tstate->curexc_value = value;
26822 tstate->curexc_traceback = tb;
26823 Py_XDECREF(tmp_type);
26824 Py_XDECREF(tmp_value);
26825 Py_XDECREF(tmp_tb);
26827 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
26828 *type = tstate->curexc_type;
26829 *value = tstate->curexc_value;
26830 *tb = tstate->curexc_traceback;
26831 tstate->curexc_type = 0;
26832 tstate->curexc_value = 0;
26833 tstate->curexc_traceback = 0;
26839 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
26840 PyFrameObject** frame,
26841 PyThreadState* tstate,
26842 const char *funcname,
26843 const char *srcfile,
26845 PyObject *type, *value, *traceback;
26847 if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
26848 if (*code == NULL) {
26849 *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
26850 if (*code == NULL)
return 0;
26852 *frame = PyFrame_New(
26858 if (*frame == NULL)
return 0;
26859 if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
26860 Py_INCREF(Py_None);
26861 (*frame)->f_trace = Py_None;
26863 #if PY_VERSION_HEX < 0x030400B1
26865 (*frame)->f_tstate = tstate;
26868 __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
26870 __Pyx_EnterTracing(tstate);
26871 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
26873 if (tstate->c_tracefunc)
26874 retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
26875 if (retval && tstate->c_profilefunc)
26877 retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
26878 __Pyx_LeaveTracing(tstate);
26880 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
26881 return __Pyx_IsTracing(tstate, 0, 0) && retval;
26885 Py_XDECREF(traceback);
26889 static PyCodeObject *__Pyx_createFrameCodeObject(
const char *funcname,
const char *srcfile,
int firstlineno) {
26890 PyCodeObject *py_code = 0;
26891 #if PY_MAJOR_VERSION >= 3
26892 py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
26893 if (likely(py_code)) {
26894 py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
26897 PyObject *py_srcfile = 0;
26898 PyObject *py_funcname = 0;
26899 py_funcname = PyString_FromString(funcname);
26900 if (unlikely(!py_funcname))
goto bad;
26901 py_srcfile = PyString_FromString(srcfile);
26902 if (unlikely(!py_srcfile))
goto bad;
26903 py_code = PyCode_New(
26907 CO_OPTIMIZED | CO_NEWLOCALS,
26920 Py_XDECREF(py_srcfile);
26921 Py_XDECREF(py_funcname);
26928 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
26929 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
26930 PyObject *dict = Py_TYPE(obj)->tp_dict;
26931 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
26933 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
26934 PyObject **dictptr = NULL;
26935 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
26937 #if CYTHON_COMPILING_IN_CPYTHON
26938 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
26940 dictptr = _PyObject_GetDictPtr(obj);
26943 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
26945 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
26946 PyObject *dict = Py_TYPE(obj)->tp_dict;
26947 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
26949 return obj_dict_version == __Pyx_get_object_dict_version(obj);
26954 #if CYTHON_USE_DICT_VERSIONS
26955 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
26957 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
26961 #if !CYTHON_AVOID_BORROWED_REFS
26962 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
26963 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
26964 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
26965 if (likely(result)) {
26966 return __Pyx_NewRef(result);
26967 }
else if (unlikely(PyErr_Occurred())) {
26971 result = PyDict_GetItem(__pyx_d, name);
26972 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
26973 if (likely(result)) {
26974 return __Pyx_NewRef(result);
26978 result = PyObject_GetItem(__pyx_d, name);
26979 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
26980 if (likely(result)) {
26981 return __Pyx_NewRef(result);
26985 return __Pyx_GetBuiltinName(name);
26989 #if CYTHON_FAST_PYCALL
26990 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
26991 PyObject *globals) {
26993 PyThreadState *tstate = __Pyx_PyThreadState_Current;
26994 PyObject **fastlocals;
26997 assert(globals != NULL);
27002 assert(tstate != NULL);
27003 f = PyFrame_New(tstate, co, globals, NULL);
27007 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
27008 for (i = 0; i < na; i++) {
27010 fastlocals[i] = *args++;
27012 result = PyEval_EvalFrameEx(f,0);
27013 ++tstate->recursion_depth;
27015 --tstate->recursion_depth;
27018 #if 1 || PY_VERSION_HEX < 0x030600B1
27019 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
27020 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
27021 PyObject *globals = PyFunction_GET_GLOBALS(func);
27022 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
27024 #if PY_MAJOR_VERSION >= 3
27027 PyObject *kwtuple, **k;
27032 assert(kwargs == NULL || PyDict_Check(kwargs));
27033 nk = kwargs ? PyDict_Size(kwargs) : 0;
27034 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
27038 #
if PY_MAJOR_VERSION >= 3
27039 co->co_kwonlyargcount == 0 &&
27041 likely(kwargs == NULL || nk == 0) &&
27042 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
27043 if (argdefs == NULL && co->co_argcount == nargs) {
27044 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
27047 else if (nargs == 0 && argdefs != NULL
27048 && co->co_argcount == Py_SIZE(argdefs)) {
27051 args = &PyTuple_GET_ITEM(argdefs, 0);
27052 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
27056 if (kwargs != NULL) {
27058 kwtuple = PyTuple_New(2 * nk);
27059 if (kwtuple == NULL) {
27063 k = &PyTuple_GET_ITEM(kwtuple, 0);
27065 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
27076 closure = PyFunction_GET_CLOSURE(func);
27077 #if PY_MAJOR_VERSION >= 3
27078 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
27080 if (argdefs != NULL) {
27081 d = &PyTuple_GET_ITEM(argdefs, 0);
27082 nd = Py_SIZE(argdefs);
27088 #if PY_MAJOR_VERSION >= 3
27089 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
27092 d, (
int)nd, kwdefs, closure);
27094 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
27097 d, (
int)nd, closure);
27099 Py_XDECREF(kwtuple);
27101 Py_LeaveRecursiveCall();
27108 #if CYTHON_FAST_PYCCALL
27109 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
27110 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
27111 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
27112 PyObject *
self = PyCFunction_GET_SELF(func);
27113 int flags = PyCFunction_GET_FLAGS(func);
27114 assert(PyCFunction_Check(func));
27115 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
27116 assert(nargs >= 0);
27117 assert(nargs == 0 || args != NULL);
27121 assert(!PyErr_Occurred());
27122 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
27123 return (*((__Pyx_PyCFunctionFastWithKeywords)(
void*)meth)) (
self, args, nargs, NULL);
27125 return (*((__Pyx_PyCFunctionFast)(
void*)meth)) (
self, args, nargs);
27131 #if CYTHON_COMPILING_IN_CPYTHON
27132 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
27134 ternaryfunc call = Py_TYPE(func)->tp_call;
27135 if (unlikely(!call))
27136 return PyObject_Call(func, arg, kw);
27137 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
27139 result = (*call)(func, arg, kw);
27140 Py_LeaveRecursiveCall();
27141 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
27144 "NULL result without error in PyObject_Call");
27151 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
27152 PyErr_Format(PyExc_ValueError,
27153 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
27157 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
27158 PyErr_Format(PyExc_ValueError,
27159 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
27160 index, (index == 1) ?
"" :
"s");
27164 static CYTHON_INLINE
int __Pyx_IterFinish(
void) {
27165 #if CYTHON_FAST_THREAD_STATE
27166 PyThreadState *tstate = __Pyx_PyThreadState_Current;
27167 PyObject* exc_type = tstate->curexc_type;
27168 if (unlikely(exc_type)) {
27169 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
27170 PyObject *exc_value, *exc_tb;
27171 exc_value = tstate->curexc_value;
27172 exc_tb = tstate->curexc_traceback;
27173 tstate->curexc_type = 0;
27174 tstate->curexc_value = 0;
27175 tstate->curexc_traceback = 0;
27176 Py_DECREF(exc_type);
27177 Py_XDECREF(exc_value);
27178 Py_XDECREF(exc_tb);
27186 if (unlikely(PyErr_Occurred())) {
27187 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
27199 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
27200 if (unlikely(retval)) {
27202 __Pyx_RaiseTooManyValuesError(expected);
27205 return __Pyx_IterFinish();
27209 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
27211 if (!j)
return NULL;
27212 r = PyObject_GetItem(o, j);
27216 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
27217 CYTHON_NCP_UNUSED
int wraparound,
27218 CYTHON_NCP_UNUSED
int boundscheck) {
27219 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
27220 Py_ssize_t wrapped_i = i;
27221 if (wraparound & unlikely(i < 0)) {
27222 wrapped_i += PyList_GET_SIZE(o);
27224 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
27225 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
27229 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
27231 return PySequence_GetItem(o, i);
27234 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
27235 CYTHON_NCP_UNUSED
int wraparound,
27236 CYTHON_NCP_UNUSED
int boundscheck) {
27237 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
27238 Py_ssize_t wrapped_i = i;
27239 if (wraparound & unlikely(i < 0)) {
27240 wrapped_i += PyTuple_GET_SIZE(o);
27242 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
27243 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
27247 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
27249 return PySequence_GetItem(o, i);
27252 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list,
27253 CYTHON_NCP_UNUSED
int wraparound,
27254 CYTHON_NCP_UNUSED
int boundscheck) {
27255 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
27256 if (is_list || PyList_CheckExact(o)) {
27257 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
27258 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
27259 PyObject *r = PyList_GET_ITEM(o, n);
27264 else if (PyTuple_CheckExact(o)) {
27265 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
27266 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
27267 PyObject *r = PyTuple_GET_ITEM(o, n);
27272 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
27273 if (likely(m && m->sq_item)) {
27274 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
27275 Py_ssize_t l = m->sq_length(o);
27276 if (likely(l >= 0)) {
27279 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
27284 return m->sq_item(o, i);
27288 if (is_list || PySequence_Check(o)) {
27289 return PySequence_GetItem(o, i);
27292 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
27296 #if CYTHON_COMPILING_IN_CPYTHON
27297 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
27298 PyObject *
self, *result;
27300 cfunc = PyCFunction_GET_FUNCTION(func);
27301 self = PyCFunction_GET_SELF(func);
27302 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
27304 result = cfunc(
self, arg);
27305 Py_LeaveRecursiveCall();
27306 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
27309 "NULL result without error in PyObject_Call");
27316 #if CYTHON_COMPILING_IN_CPYTHON
27317 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
27318 #if CYTHON_FAST_PYCALL
27319 if (PyFunction_Check(func)) {
27320 return __Pyx_PyFunction_FastCall(func, NULL, 0);
27323 #if defined(__Pyx_CyFunction_USED) && defined(NDEBUG)
27324 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
27326 if (likely(PyCFunction_Check(func)))
27329 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
27330 return __Pyx_PyObject_CallMethO(func, NULL);
27333 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
27338 #if CYTHON_COMPILING_IN_CPYTHON
27339 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
27341 PyObject *args = PyTuple_New(1);
27342 if (unlikely(!args))
return NULL;
27344 PyTuple_SET_ITEM(args, 0, arg);
27345 result = __Pyx_PyObject_Call(func, args, NULL);
27349 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
27350 #if CYTHON_FAST_PYCALL
27351 if (PyFunction_Check(func)) {
27352 return __Pyx_PyFunction_FastCall(func, &arg, 1);
27355 if (likely(PyCFunction_Check(func))) {
27356 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
27357 return __Pyx_PyObject_CallMethO(func, arg);
27358 #if CYTHON_FAST_PYCCALL
27359 }
else if (__Pyx_PyFastCFunction_Check(func)) {
27360 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
27364 return __Pyx__PyObject_CallOneArg(func, arg);
27367 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
27369 PyObject *args = PyTuple_Pack(1, arg);
27370 if (unlikely(!args))
return NULL;
27371 result = __Pyx_PyObject_Call(func, args, NULL);
27378 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2) {
27379 PyObject *args, *result = NULL;
27380 #if CYTHON_FAST_PYCALL
27381 if (PyFunction_Check(
function)) {
27382 PyObject *args[2] = {arg1, arg2};
27383 return __Pyx_PyFunction_FastCall(
function, args, 2);
27386 #if CYTHON_FAST_PYCCALL
27387 if (__Pyx_PyFastCFunction_Check(
function)) {
27388 PyObject *args[2] = {arg1, arg2};
27389 return __Pyx_PyCFunction_FastCall(
function, args, 2);
27392 args = PyTuple_New(2);
27393 if (unlikely(!args))
goto done;
27395 PyTuple_SET_ITEM(args, 0, arg1);
27397 PyTuple_SET_ITEM(args, 1, arg2);
27398 Py_INCREF(
function);
27399 result = __Pyx_PyObject_Call(
function, args, NULL);
27401 Py_DECREF(
function);
27407 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
27408 #if CYTHON_COMPILING_IN_PYPY
27409 return PyObject_RichCompareBool(s1, s2, equals);
27412 return (equals == Py_EQ);
27413 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
27414 const char *ps1, *ps2;
27415 Py_ssize_t length = PyBytes_GET_SIZE(s1);
27416 if (length != PyBytes_GET_SIZE(s2))
27417 return (equals == Py_NE);
27418 ps1 = PyBytes_AS_STRING(s1);
27419 ps2 = PyBytes_AS_STRING(s2);
27420 if (ps1[0] != ps2[0]) {
27421 return (equals == Py_NE);
27422 }
else if (length == 1) {
27423 return (equals == Py_EQ);
27426 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
27427 Py_hash_t hash1, hash2;
27428 hash1 = ((PyBytesObject*)s1)->ob_shash;
27429 hash2 = ((PyBytesObject*)s2)->ob_shash;
27430 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
27431 return (equals == Py_NE);
27434 result = memcmp(ps1, ps2, (
size_t)length);
27435 return (equals == Py_EQ) ? (result == 0) : (result != 0);
27437 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
27438 return (equals == Py_NE);
27439 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
27440 return (equals == Py_NE);
27443 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
27446 result = __Pyx_PyObject_IsTrue(py_result);
27447 Py_DECREF(py_result);
27454 #if PY_MAJOR_VERSION < 3
27455 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
27456 CYTHON_UNUSED PyObject *cause) {
27457 __Pyx_PyThreadState_declare
27459 if (!value || value == Py_None)
27463 if (!tb || tb == Py_None)
27467 if (!PyTraceBack_Check(tb)) {
27468 PyErr_SetString(PyExc_TypeError,
27469 "raise: arg 3 must be a traceback or None");
27473 if (PyType_Check(type)) {
27474 #if CYTHON_COMPILING_IN_PYPY
27476 Py_INCREF(Py_None);
27480 PyErr_NormalizeException(&type, &value, &tb);
27483 PyErr_SetString(PyExc_TypeError,
27484 "instance exception may not have a separate value");
27488 type = (PyObject*) Py_TYPE(type);
27490 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
27491 PyErr_SetString(PyExc_TypeError,
27492 "raise: exception class must be a subclass of BaseException");
27496 __Pyx_PyThreadState_assign
27497 __Pyx_ErrRestore(type, value, tb);
27506 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
27507 PyObject* owned_instance = NULL;
27508 if (tb == Py_None) {
27510 }
else if (tb && !PyTraceBack_Check(tb)) {
27511 PyErr_SetString(PyExc_TypeError,
27512 "raise: arg 3 must be a traceback or None");
27515 if (value == Py_None)
27517 if (PyExceptionInstance_Check(type)) {
27519 PyErr_SetString(PyExc_TypeError,
27520 "instance exception may not have a separate value");
27524 type = (PyObject*) Py_TYPE(value);
27525 }
else if (PyExceptionClass_Check(type)) {
27526 PyObject *instance_class = NULL;
27527 if (value && PyExceptionInstance_Check(value)) {
27528 instance_class = (PyObject*) Py_TYPE(value);
27529 if (instance_class != type) {
27530 int is_subclass = PyObject_IsSubclass(instance_class, type);
27531 if (!is_subclass) {
27532 instance_class = NULL;
27533 }
else if (unlikely(is_subclass == -1)) {
27536 type = instance_class;
27540 if (!instance_class) {
27543 args = PyTuple_New(0);
27544 else if (PyTuple_Check(value)) {
27548 args = PyTuple_Pack(1, value);
27551 owned_instance = PyObject_Call(type, args, NULL);
27553 if (!owned_instance)
27555 value = owned_instance;
27556 if (!PyExceptionInstance_Check(value)) {
27557 PyErr_Format(PyExc_TypeError,
27558 "calling %R should have returned an instance of "
27559 "BaseException, not %R",
27560 type, Py_TYPE(value));
27565 PyErr_SetString(PyExc_TypeError,
27566 "raise: exception class must be a subclass of BaseException");
27570 PyObject *fixed_cause;
27571 if (cause == Py_None) {
27572 fixed_cause = NULL;
27573 }
else if (PyExceptionClass_Check(cause)) {
27574 fixed_cause = PyObject_CallObject(cause, NULL);
27575 if (fixed_cause == NULL)
27577 }
else if (PyExceptionInstance_Check(cause)) {
27578 fixed_cause = cause;
27579 Py_INCREF(fixed_cause);
27581 PyErr_SetString(PyExc_TypeError,
27582 "exception causes must derive from "
27586 PyException_SetCause(value, fixed_cause);
27588 PyErr_SetObject(type, value);
27590 #if CYTHON_FAST_THREAD_STATE
27591 PyThreadState *tstate = __Pyx_PyThreadState_Current;
27592 PyObject* tmp_tb = tstate->curexc_traceback;
27593 if (tb != tmp_tb) {
27595 tstate->curexc_traceback = tb;
27596 Py_XDECREF(tmp_tb);
27599 PyObject *tmp_type, *tmp_value, *tmp_tb;
27600 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
27602 PyErr_Restore(tmp_type, tmp_value, tb);
27603 Py_XDECREF(tmp_tb);
27607 Py_XDECREF(owned_instance);
27613 static CYTHON_INLINE
int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
27614 Py_ssize_t cstart, Py_ssize_t cstop,
27615 PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
27616 int has_cstart,
int has_cstop, CYTHON_UNUSED
int wraparound) {
27617 #if CYTHON_USE_TYPE_SLOTS
27618 PyMappingMethods* mp;
27619 #if PY_MAJOR_VERSION < 3
27620 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
27621 if (likely(ms && ms->sq_ass_slice)) {
27623 if (_py_start && (*_py_start != Py_None)) {
27624 cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
27625 if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred())
goto bad;
27630 if (_py_stop && (*_py_stop != Py_None)) {
27631 cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
27632 if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred())
goto bad;
27634 cstop = PY_SSIZE_T_MAX;
27636 if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
27637 Py_ssize_t l = ms->sq_length(obj);
27638 if (likely(l >= 0)) {
27641 if (cstop < 0) cstop = 0;
27645 if (cstart < 0) cstart = 0;
27648 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
27653 return ms->sq_ass_slice(obj, cstart, cstop, value);
27656 mp = Py_TYPE(obj)->tp_as_mapping;
27657 if (likely(mp && mp->mp_ass_subscript))
27661 PyObject *py_slice, *py_start, *py_stop;
27663 py_slice = *_py_slice;
27665 PyObject* owned_start = NULL;
27666 PyObject* owned_stop = NULL;
27668 py_start = *_py_start;
27671 owned_start = py_start = PyInt_FromSsize_t(cstart);
27672 if (unlikely(!py_start))
goto bad;
27674 py_start = Py_None;
27677 py_stop = *_py_stop;
27680 owned_stop = py_stop = PyInt_FromSsize_t(cstop);
27681 if (unlikely(!py_stop)) {
27682 Py_XDECREF(owned_start);
27688 py_slice = PySlice_New(py_start, py_stop, Py_None);
27689 Py_XDECREF(owned_start);
27690 Py_XDECREF(owned_stop);
27691 if (unlikely(!py_slice))
goto bad;
27693 #if CYTHON_USE_TYPE_SLOTS
27694 result = mp->mp_ass_subscript(obj, py_slice, value);
27696 result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
27699 Py_DECREF(py_slice);
27703 PyErr_Format(PyExc_TypeError,
27704 "'%.200s' object does not support slice %.10s",
27705 Py_TYPE(obj)->tp_name, value ?
"assignment" :
"deletion");
27711 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval, CYTHON_UNUSED
long inplace) {
27715 #if PY_MAJOR_VERSION < 3
27716 if (likely(PyInt_CheckExact(op1))) {
27717 const long b = intval;
27718 long a = PyInt_AS_LONG(op1);
27719 if (a == b) Py_RETURN_TRUE;
else Py_RETURN_FALSE;
27722 #if CYTHON_USE_PYLONG_INTERNALS
27723 if (likely(PyLong_CheckExact(op1))) {
27725 unsigned long uintval;
27726 Py_ssize_t size = Py_SIZE(op1);
27727 const digit* digits = ((PyLongObject*)op1)->ob_digit;
27729 if (size == 0) Py_RETURN_TRUE;
else Py_RETURN_FALSE;
27730 }
else if (intval < 0) {
27739 uintval = (
unsigned long) intval;
27740 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
27741 if (uintval >> (PyLong_SHIFT * 4)) {
27742 unequal = (size != 5) || (digits[0] != (uintval & (
unsigned long) PyLong_MASK))
27743 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK));
27746 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
27747 if (uintval >> (PyLong_SHIFT * 3)) {
27748 unequal = (size != 4) || (digits[0] != (uintval & (
unsigned long) PyLong_MASK))
27749 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK));
27752 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
27753 if (uintval >> (PyLong_SHIFT * 2)) {
27754 unequal = (size != 3) || (digits[0] != (uintval & (
unsigned long) PyLong_MASK))
27755 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK));
27758 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
27759 if (uintval >> (PyLong_SHIFT * 1)) {
27760 unequal = (size != 2) || (digits[0] != (uintval & (
unsigned long) PyLong_MASK))
27761 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (
unsigned long) PyLong_MASK));
27764 unequal = (size != 1) || (((
unsigned long) digits[0]) != (uintval & (
unsigned long) PyLong_MASK));
27765 if (unequal == 0) Py_RETURN_TRUE;
else Py_RETURN_FALSE;
27768 if (PyFloat_CheckExact(op1)) {
27769 const long b = intval;
27770 double a = PyFloat_AS_DOUBLE(op1);
27771 if ((
double)a == (
double)b) Py_RETURN_TRUE;
else Py_RETURN_FALSE;
27774 PyObject_RichCompare(op1, op2, Py_EQ));
27778 #if PY_VERSION_HEX < 0x03050000
27779 static PyObject* __Pyx_PyObject_CallMatrixMethod(PyObject* method, PyObject* arg) {
27780 PyObject *result = NULL;
27781 #if CYTHON_UNPACK_METHODS
27782 if (likely(PyMethod_Check(method))) {
27783 PyObject *
self = PyMethod_GET_SELF(method);
27784 if (likely(
self)) {
27786 PyObject *
function = PyMethod_GET_FUNCTION(method);
27787 #if CYTHON_FAST_PYCALL
27788 if (PyFunction_Check(
function)) {
27789 PyObject *args[2] = {
self, arg};
27790 result = __Pyx_PyFunction_FastCall(
function, args, 2);
27794 #if CYTHON_FAST_PYCCALL
27795 if (__Pyx_PyFastCFunction_Check(
function)) {
27796 PyObject *args[2] = {
self, arg};
27797 result = __Pyx_PyCFunction_FastCall(
function, args, 2);
27801 args = PyTuple_New(2);
27802 if (unlikely(!args))
goto done;
27804 PyTuple_SET_ITEM(args, 0,
self);
27806 PyTuple_SET_ITEM(args, 1, arg);
27807 Py_INCREF(
function);
27808 Py_DECREF(method); method = NULL;
27809 result = __Pyx_PyObject_Call(
function, args, NULL);
27811 Py_DECREF(
function);
27816 result = __Pyx_PyObject_CallOneArg(method, arg);
27821 #define __Pyx_TryMatrixMethod(x, y, py_method_name) {\
27822 PyObject *func = __Pyx_PyObject_GetAttrStr(x, py_method_name);\
27824 PyObject *result = __Pyx_PyObject_CallMatrixMethod(func, y);\
27825 if (result != Py_NotImplemented)\
27827 Py_DECREF(result);\
27829 if (!PyErr_ExceptionMatches(PyExc_AttributeError))\
27834 static PyObject* __Pyx__PyNumber_MatrixMultiply(PyObject* x, PyObject* y,
const char* op_name) {
27835 int right_is_subtype = PyObject_IsSubclass((PyObject*)Py_TYPE(y), (PyObject*)Py_TYPE(x));
27836 if (unlikely(right_is_subtype == -1))
27838 if (right_is_subtype) {
27839 __Pyx_TryMatrixMethod(y, x, __pyx_n_s_rmatmul)
27841 __Pyx_TryMatrixMethod(x, y, __pyx_n_s_matmul)
27842 if (!right_is_subtype) {
27843 __Pyx_TryMatrixMethod(y, x, __pyx_n_s_rmatmul)
27845 PyErr_Format(PyExc_TypeError,
27846 "unsupported operand type(s) for %.2s: '%.100s' and '%.100s'",
27848 Py_TYPE(x)->tp_name,
27849 Py_TYPE(y)->tp_name);
27852 static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y) {
27853 __Pyx_TryMatrixMethod(x, y, __pyx_n_s_imatmul)
27854 return __Pyx__PyNumber_MatrixMultiply(x, y,
"@=");
27856 #undef __Pyx_TryMatrixMethod
27860 #if CYTHON_USE_TYPE_SLOTS
27861 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
27862 PyObject *runerr = NULL;
27863 Py_ssize_t key_value;
27864 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
27865 if (unlikely(!(m && m->sq_item))) {
27866 PyErr_Format(PyExc_TypeError,
"'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
27869 key_value = __Pyx_PyIndex_AsSsize_t(index);
27870 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
27871 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
27873 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
27875 PyErr_Format(PyExc_IndexError,
"cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
27879 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
27880 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
27881 if (likely(m && m->mp_subscript)) {
27882 return m->mp_subscript(obj, key);
27884 return __Pyx_PyObject_GetIndex(obj, key);
27889 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
27892 r = PyObject_SetItem(o, j, v);
27896 static CYTHON_INLINE
int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
int is_list,
27897 CYTHON_NCP_UNUSED
int wraparound, CYTHON_NCP_UNUSED
int boundscheck) {
27898 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
27899 if (is_list || PyList_CheckExact(o)) {
27900 Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
27901 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
27902 PyObject* old = PyList_GET_ITEM(o, n);
27904 PyList_SET_ITEM(o, n, v);
27909 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
27910 if (likely(m && m->sq_ass_item)) {
27911 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
27912 Py_ssize_t l = m->sq_length(o);
27913 if (likely(l >= 0)) {
27916 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
27921 return m->sq_ass_item(o, i, v);
27925 #if CYTHON_COMPILING_IN_PYPY
27926 if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
27928 if (is_list || PySequence_Check(o))
27931 return PySequence_SetItem(o, i, v);
27934 return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
27939 __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
27941 __Pyx_memviewslice *memviewslice,
27942 int memview_is_new_reference)
27944 __Pyx_RefNannyDeclarations
27946 Py_buffer *buf = &memview->view;
27947 __Pyx_RefNannySetupContext(
"init_memviewslice", 0);
27948 if (unlikely(memviewslice->memview || memviewslice->data)) {
27949 PyErr_SetString(PyExc_ValueError,
27950 "memviewslice is already initialized!");
27953 if (buf->strides) {
27954 for (i = 0; i < ndim; i++) {
27955 memviewslice->strides[i] = buf->strides[i];
27958 Py_ssize_t stride = buf->itemsize;
27959 for (i = ndim - 1; i >= 0; i--) {
27960 memviewslice->strides[i] = stride;
27961 stride *= buf->shape[i];
27964 for (i = 0; i < ndim; i++) {
27965 memviewslice->shape[i] = buf->shape[i];
27966 if (buf->suboffsets) {
27967 memviewslice->suboffsets[i] = buf->suboffsets[i];
27969 memviewslice->suboffsets[i] = -1;
27972 memviewslice->memview = memview;
27973 memviewslice->data = (
char *)buf->buf;
27974 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
27975 Py_INCREF(memview);
27980 memviewslice->memview = 0;
27981 memviewslice->data = 0;
27984 __Pyx_RefNannyFinishContext();
27987 #ifndef Py_NO_RETURN
27988 #define Py_NO_RETURN
27990 static void __pyx_fatalerror(
const char *fmt, ...) Py_NO_RETURN {
27993 #if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES)
27994 va_start(vargs, fmt);
27998 vsnprintf(msg, 200, fmt, vargs);
28000 Py_FatalError(msg);
28002 static CYTHON_INLINE
int
28003 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
28004 PyThread_type_lock lock)
28007 PyThread_acquire_lock(lock, 1);
28008 result = (*acquisition_count)++;
28009 PyThread_release_lock(lock);
28012 static CYTHON_INLINE
int
28013 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
28014 PyThread_type_lock lock)
28017 PyThread_acquire_lock(lock, 1);
28018 result = (*acquisition_count)--;
28019 PyThread_release_lock(lock);
28022 static CYTHON_INLINE
void
28023 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice,
int have_gil,
int lineno)
28026 struct __pyx_memoryview_obj *memview = memslice->memview;
28027 if (unlikely(!memview || (PyObject *) memview == Py_None))
28029 if (unlikely(__pyx_get_slice_count(memview) < 0))
28030 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
28031 __pyx_get_slice_count(memview), lineno);
28032 first_time = __pyx_add_acquisition_count(memview) == 0;
28033 if (unlikely(first_time)) {
28035 Py_INCREF((PyObject *) memview);
28037 PyGILState_STATE _gilstate = PyGILState_Ensure();
28038 Py_INCREF((PyObject *) memview);
28039 PyGILState_Release(_gilstate);
28043 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
28044 int have_gil,
int lineno) {
28046 struct __pyx_memoryview_obj *memview = memslice->memview;
28047 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
28048 memslice->memview = NULL;
28051 if (unlikely(__pyx_get_slice_count(memview) <= 0))
28052 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
28053 __pyx_get_slice_count(memview), lineno);
28054 last_time = __pyx_sub_acquisition_count(memview) == 1;
28055 memslice->data = NULL;
28056 if (unlikely(last_time)) {
28058 Py_CLEAR(memslice->memview);
28060 PyGILState_STATE _gilstate = PyGILState_Ensure();
28061 Py_CLEAR(memslice->memview);
28062 PyGILState_Release(_gilstate);
28065 memslice->memview = NULL;
28070 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname) {
28071 PyErr_Format(PyExc_UnboundLocalError,
"local variable '%s' referenced before assignment", varname);
28075 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
28077 if (unlikely(!type)) {
28078 PyErr_SetString(PyExc_SystemError,
"Missing type object");
28082 #if PY_MAJOR_VERSION == 2
28083 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
28087 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
28089 PyErr_Format(PyExc_TypeError,
28090 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
28091 name, type->tp_name, Py_TYPE(obj)->tp_name);
28096 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
28097 #if CYTHON_COMPILING_IN_PYPY
28098 return PyObject_RichCompareBool(s1, s2, equals);
28100 #if PY_MAJOR_VERSION < 3
28101 PyObject* owned_ref = NULL;
28103 int s1_is_unicode, s2_is_unicode;
28107 s1_is_unicode = PyUnicode_CheckExact(s1);
28108 s2_is_unicode = PyUnicode_CheckExact(s2);
28109 #if PY_MAJOR_VERSION < 3
28110 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
28111 owned_ref = PyUnicode_FromObject(s2);
28112 if (unlikely(!owned_ref))
28116 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
28117 owned_ref = PyUnicode_FromObject(s1);
28118 if (unlikely(!owned_ref))
28122 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
28123 return __Pyx_PyBytes_Equals(s1, s2, equals);
28126 if (s1_is_unicode & s2_is_unicode) {
28129 void *data1, *data2;
28130 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
28132 length = __Pyx_PyUnicode_GET_LENGTH(s1);
28133 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
28136 #if CYTHON_USE_UNICODE_INTERNALS
28138 Py_hash_t hash1, hash2;
28139 #if CYTHON_PEP393_ENABLED
28140 hash1 = ((PyASCIIObject*)s1)->hash;
28141 hash2 = ((PyASCIIObject*)s2)->hash;
28143 hash1 = ((PyUnicodeObject*)s1)->hash;
28144 hash2 = ((PyUnicodeObject*)s2)->hash;
28146 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
28151 kind = __Pyx_PyUnicode_KIND(s1);
28152 if (kind != __Pyx_PyUnicode_KIND(s2)) {
28155 data1 = __Pyx_PyUnicode_DATA(s1);
28156 data2 = __Pyx_PyUnicode_DATA(s2);
28157 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
28159 }
else if (length == 1) {
28162 int result = memcmp(data1, data2, (
size_t)(length * kind));
28163 #if PY_MAJOR_VERSION < 3
28164 Py_XDECREF(owned_ref);
28166 return (equals == Py_EQ) ? (result == 0) : (result != 0);
28168 }
else if ((s1 == Py_None) & s2_is_unicode) {
28170 }
else if ((s2 == Py_None) & s1_is_unicode) {
28174 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
28175 #if PY_MAJOR_VERSION < 3
28176 Py_XDECREF(owned_ref);
28180 result = __Pyx_PyObject_IsTrue(py_result);
28181 Py_DECREF(py_result);
28185 #if PY_MAJOR_VERSION < 3
28186 Py_XDECREF(owned_ref);
28188 return (equals == Py_EQ);
28190 #if PY_MAJOR_VERSION < 3
28191 Py_XDECREF(owned_ref);
28193 return (equals == Py_NE);
28198 static void __Pyx_WriteUnraisable(
const char *name, CYTHON_UNUSED
int clineno,
28199 CYTHON_UNUSED
int lineno, CYTHON_UNUSED
const char *filename,
28200 int full_traceback, CYTHON_UNUSED
int nogil) {
28201 PyObject *old_exc, *old_val, *old_tb;
28203 __Pyx_PyThreadState_declare
28205 PyGILState_STATE state;
28207 state = PyGILState_Ensure();
28208 else state = (PyGILState_STATE)0;
28210 __Pyx_PyThreadState_assign
28211 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
28212 if (full_traceback) {
28213 Py_XINCREF(old_exc);
28214 Py_XINCREF(old_val);
28215 Py_XINCREF(old_tb);
28216 __Pyx_ErrRestore(old_exc, old_val, old_tb);
28219 #if PY_MAJOR_VERSION < 3
28220 ctx = PyString_FromString(name);
28222 ctx = PyUnicode_FromString(name);
28224 __Pyx_ErrRestore(old_exc, old_val, old_tb);
28226 PyErr_WriteUnraisable(Py_None);
28228 PyErr_WriteUnraisable(ctx);
28233 PyGILState_Release(state);
28238 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
28239 #if CYTHON_USE_TYPE_SLOTS
28240 #if PY_MAJOR_VERSION >= 3
28241 if (likely(PyUnicode_Check(n)))
28243 if (likely(PyString_Check(n)))
28245 return __Pyx_PyObject_GetAttrStr(o, n);
28247 return PyObject_GetAttr(o, n);
28251 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
28252 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
28253 const char* encoding,
const char* errors,
28254 PyObject* (*decode_func)(
const char *s, Py_ssize_t size,
const char *errors)) {
28256 if (unlikely((start < 0) | (stop < 0))) {
28257 size_t slen = strlen(cstring);
28258 if (unlikely(slen > (
size_t) PY_SSIZE_T_MAX)) {
28259 PyErr_SetString(PyExc_OverflowError,
28260 "c-string too long to convert to Python");
28263 length = (Py_ssize_t) slen;
28272 if (unlikely(stop <= start))
28273 return __Pyx_NewRef(__pyx_empty_unicode);
28274 length = stop - start;
28277 return decode_func(cstring, length, errors);
28279 return PyUnicode_Decode(cstring, length, encoding, errors);
28284 #if CYTHON_FAST_THREAD_STATE
28285 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
28287 n = PyTuple_GET_SIZE(tuple);
28288 #if PY_MAJOR_VERSION >= 3
28289 for (i=0; i<n; i++) {
28290 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
28293 for (i=0; i<n; i++) {
28294 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
28298 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
28299 PyObject *exc_type = tstate->curexc_type;
28300 if (exc_type == err)
return 1;
28301 if (unlikely(!exc_type))
return 0;
28302 if (unlikely(PyTuple_Check(err)))
28303 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
28304 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
28309 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
28310 __Pyx_PyThreadState_declare
28311 __Pyx_PyThreadState_assign
28312 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
28314 __Pyx_PyErr_Clear();
28318 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
28319 PyObject *r = __Pyx_GetAttr(o, n);
28320 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
28324 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void) {
28325 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
28329 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
28330 if (unlikely(!type)) {
28331 PyErr_SetString(PyExc_SystemError,
"Missing type object");
28334 if (likely(__Pyx_TypeCheck(obj, type)))
28336 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
28337 Py_TYPE(obj)->tp_name, type->tp_name);
28342 #if CYTHON_USE_EXC_INFO_STACK
28343 static _PyErr_StackItem *
28344 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
28346 _PyErr_StackItem *exc_info = tstate->exc_info;
28347 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
28348 exc_info->previous_item != NULL)
28350 exc_info = exc_info->previous_item;
28357 #if CYTHON_FAST_THREAD_STATE
28358 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
28359 #if CYTHON_USE_EXC_INFO_STACK
28360 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
28361 *type = exc_info->exc_type;
28362 *value = exc_info->exc_value;
28363 *tb = exc_info->exc_traceback;
28365 *type = tstate->exc_type;
28366 *value = tstate->exc_value;
28367 *tb = tstate->exc_traceback;
28370 Py_XINCREF(*value);
28373 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
28374 PyObject *tmp_type, *tmp_value, *tmp_tb;
28375 #if CYTHON_USE_EXC_INFO_STACK
28376 _PyErr_StackItem *exc_info = tstate->exc_info;
28377 tmp_type = exc_info->exc_type;
28378 tmp_value = exc_info->exc_value;
28379 tmp_tb = exc_info->exc_traceback;
28380 exc_info->exc_type = type;
28381 exc_info->exc_value = value;
28382 exc_info->exc_traceback = tb;
28384 tmp_type = tstate->exc_type;
28385 tmp_value = tstate->exc_value;
28386 tmp_tb = tstate->exc_traceback;
28387 tstate->exc_type = type;
28388 tstate->exc_value = value;
28389 tstate->exc_traceback = tb;
28391 Py_XDECREF(tmp_type);
28392 Py_XDECREF(tmp_value);
28393 Py_XDECREF(tmp_tb);
28398 #if CYTHON_FAST_THREAD_STATE
28399 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
28401 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
28404 PyObject *local_type, *local_value, *local_tb;
28405 #if CYTHON_FAST_THREAD_STATE
28406 PyObject *tmp_type, *tmp_value, *tmp_tb;
28407 local_type = tstate->curexc_type;
28408 local_value = tstate->curexc_value;
28409 local_tb = tstate->curexc_traceback;
28410 tstate->curexc_type = 0;
28411 tstate->curexc_value = 0;
28412 tstate->curexc_traceback = 0;
28414 PyErr_Fetch(&local_type, &local_value, &local_tb);
28416 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
28417 #if CYTHON_FAST_THREAD_STATE
28418 if (unlikely(tstate->curexc_type))
28420 if (unlikely(PyErr_Occurred()))
28423 #if PY_MAJOR_VERSION >= 3
28425 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
28429 Py_XINCREF(local_tb);
28430 Py_XINCREF(local_type);
28431 Py_XINCREF(local_value);
28432 *type = local_type;
28433 *value = local_value;
28435 #if CYTHON_FAST_THREAD_STATE
28436 #if CYTHON_USE_EXC_INFO_STACK
28438 _PyErr_StackItem *exc_info = tstate->exc_info;
28439 tmp_type = exc_info->exc_type;
28440 tmp_value = exc_info->exc_value;
28441 tmp_tb = exc_info->exc_traceback;
28442 exc_info->exc_type = local_type;
28443 exc_info->exc_value = local_value;
28444 exc_info->exc_traceback = local_tb;
28447 tmp_type = tstate->exc_type;
28448 tmp_value = tstate->exc_value;
28449 tmp_tb = tstate->exc_traceback;
28450 tstate->exc_type = local_type;
28451 tstate->exc_value = local_value;
28452 tstate->exc_traceback = local_tb;
28454 Py_XDECREF(tmp_type);
28455 Py_XDECREF(tmp_value);
28456 Py_XDECREF(tmp_tb);
28458 PyErr_SetExcInfo(local_type, local_value, local_tb);
28465 Py_XDECREF(local_type);
28466 Py_XDECREF(local_value);
28467 Py_XDECREF(local_tb);
28472 #if CYTHON_FAST_THREAD_STATE
28473 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
28474 PyObject *tmp_type, *tmp_value, *tmp_tb;
28475 #if CYTHON_USE_EXC_INFO_STACK
28476 _PyErr_StackItem *exc_info = tstate->exc_info;
28477 tmp_type = exc_info->exc_type;
28478 tmp_value = exc_info->exc_value;
28479 tmp_tb = exc_info->exc_traceback;
28480 exc_info->exc_type = *type;
28481 exc_info->exc_value = *value;
28482 exc_info->exc_traceback = *tb;
28484 tmp_type = tstate->exc_type;
28485 tmp_value = tstate->exc_value;
28486 tmp_tb = tstate->exc_traceback;
28487 tstate->exc_type = *type;
28488 tstate->exc_value = *value;
28489 tstate->exc_traceback = *tb;
28492 *value = tmp_value;
28496 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
28497 PyObject *tmp_type, *tmp_value, *tmp_tb;
28498 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
28499 PyErr_SetExcInfo(*type, *value, *tb);
28501 *value = tmp_value;
28507 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
28508 PyObject *empty_list = 0;
28509 PyObject *module = 0;
28510 PyObject *global_dict = 0;
28511 PyObject *empty_dict = 0;
28513 #if PY_MAJOR_VERSION < 3
28514 PyObject *py_import;
28515 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
28522 empty_list = PyList_New(0);
28527 global_dict = PyModule_GetDict(__pyx_m);
28530 empty_dict = PyDict_New();
28534 #if PY_MAJOR_VERSION >= 3
28536 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
28537 module = PyImport_ImportModuleLevelObject(
28538 name, global_dict, empty_dict, list, 1);
28540 if (!PyErr_ExceptionMatches(PyExc_ImportError))
28549 #if PY_MAJOR_VERSION < 3
28550 PyObject *py_level = PyInt_FromLong(level);
28553 module = PyObject_CallFunctionObjArgs(py_import,
28554 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
28555 Py_DECREF(py_level);
28557 module = PyImport_ImportModuleLevelObject(
28558 name, global_dict, empty_dict, list, level);
28563 #if PY_MAJOR_VERSION < 3
28564 Py_XDECREF(py_import);
28566 Py_XDECREF(empty_list);
28567 Py_XDECREF(empty_dict);
28572 #if CYTHON_COMPILING_IN_CPYTHON
28573 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
28579 return b == &PyBaseObject_Type;
28581 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
28583 if (a == b)
return 1;
28587 n = PyTuple_GET_SIZE(mro);
28588 for (i = 0; i < n; i++) {
28589 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
28594 return __Pyx_InBases(a, b);
28596 #if PY_MAJOR_VERSION == 2
28597 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
28598 PyObject *exception, *value, *tb;
28600 __Pyx_PyThreadState_declare
28601 __Pyx_PyThreadState_assign
28602 __Pyx_ErrFetch(&exception, &value, &tb);
28603 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
28604 if (unlikely(res == -1)) {
28605 PyErr_WriteUnraisable(err);
28609 res = PyObject_IsSubclass(err, exc_type2);
28610 if (unlikely(res == -1)) {
28611 PyErr_WriteUnraisable(err);
28615 __Pyx_ErrRestore(exception, value, tb);
28619 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
28620 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
28622 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
28627 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
28629 assert(PyExceptionClass_Check(exc_type));
28630 n = PyTuple_GET_SIZE(tuple);
28631 #if PY_MAJOR_VERSION >= 3
28632 for (i=0; i<n; i++) {
28633 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
28636 for (i=0; i<n; i++) {
28637 PyObject *t = PyTuple_GET_ITEM(tuple, i);
28638 #if PY_MAJOR_VERSION < 3
28639 if (likely(exc_type == t))
return 1;
28641 if (likely(PyExceptionClass_Check(t))) {
28642 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
28648 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
28649 if (likely(err == exc_type))
return 1;
28650 if (likely(PyExceptionClass_Check(err))) {
28651 if (likely(PyExceptionClass_Check(exc_type))) {
28652 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
28653 }
else if (likely(PyTuple_Check(exc_type))) {
28654 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
28658 return PyErr_GivenExceptionMatches(err, exc_type);
28660 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
28661 assert(PyExceptionClass_Check(exc_type1));
28662 assert(PyExceptionClass_Check(exc_type2));
28663 if (likely(err == exc_type1 || err == exc_type2))
return 1;
28664 if (likely(PyExceptionClass_Check(err))) {
28665 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
28667 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
28672 #if !CYTHON_COMPILING_IN_PYPY
28673 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval,
int inplace,
int zerodivision_check) {
28675 (void)zerodivision_check;
28676 #if PY_MAJOR_VERSION < 3
28677 if (likely(PyInt_CheckExact(op1))) {
28678 const long b = intval;
28680 long a = PyInt_AS_LONG(op1);
28681 x = (long)((
unsigned long)a + b);
28682 if (likely((x^a) >= 0 || (x^b) >= 0))
28683 return PyInt_FromLong(x);
28684 return PyLong_Type.tp_as_number->nb_add(op1, op2);
28687 #if CYTHON_USE_PYLONG_INTERNALS
28688 if (likely(PyLong_CheckExact(op1))) {
28689 const long b = intval;
28691 #ifdef HAVE_LONG_LONG
28692 const PY_LONG_LONG llb = intval;
28693 PY_LONG_LONG lla, llx;
28695 const digit* digits = ((PyLongObject*)op1)->ob_digit;
28696 const Py_ssize_t size = Py_SIZE(op1);
28697 if (likely(__Pyx_sst_abs(size) <= 1)) {
28698 a = likely(size) ? digits[0] : 0;
28699 if (size == -1) a = -a;
28703 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28704 a = -(long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
28706 #ifdef HAVE_LONG_LONG
28707 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
28708 lla = -(PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
28712 CYTHON_FALLTHROUGH;
28714 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28715 a = (long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
28717 #ifdef HAVE_LONG_LONG
28718 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
28719 lla = (PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
28723 CYTHON_FALLTHROUGH;
28725 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28726 a = -(long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
28728 #ifdef HAVE_LONG_LONG
28729 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
28730 lla = -(PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
28734 CYTHON_FALLTHROUGH;
28736 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28737 a = (long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
28739 #ifdef HAVE_LONG_LONG
28740 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
28741 lla = (PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
28745 CYTHON_FALLTHROUGH;
28747 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
28748 a = -(long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
28750 #ifdef HAVE_LONG_LONG
28751 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
28752 lla = -(PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
28756 CYTHON_FALLTHROUGH;
28758 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
28759 a = (long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
28761 #ifdef HAVE_LONG_LONG
28762 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
28763 lla = (PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
28767 CYTHON_FALLTHROUGH;
28768 default:
return PyLong_Type.tp_as_number->nb_add(op1, op2);
28772 return PyLong_FromLong(x);
28773 #ifdef HAVE_LONG_LONG
28776 return PyLong_FromLongLong(llx);
28782 if (PyFloat_CheckExact(op1)) {
28783 const long b = intval;
28784 double a = PyFloat_AS_DOUBLE(op1);
28786 PyFPE_START_PROTECT(
"add",
return NULL)
28787 result = ((double)a) + (double)b;
28788 PyFPE_END_PROTECT(result)
28789 return PyFloat_FromDouble(result);
28791 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
28796 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
28797 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
28798 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
28799 PyErr_Format(PyExc_ImportError,
28800 #
if PY_MAJOR_VERSION < 3
28801 "cannot import name %.230s", PyString_AS_STRING(name));
28803 "cannot import name %S", name);
28810 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *o, PyObject *n) {
28812 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
28813 PyErr_SetString(PyExc_TypeError,
28814 "hasattr(): attribute name must be string");
28817 r = __Pyx_GetAttr(o, n);
28818 if (unlikely(!r)) {
28828 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
28829 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
28830 PyErr_Format(PyExc_AttributeError,
28831 #
if PY_MAJOR_VERSION >= 3
28832 "'%.50s' object has no attribute '%U'",
28833 tp->tp_name, attr_name);
28835 "'%.50s' object has no attribute '%.400s'",
28836 tp->tp_name, PyString_AS_STRING(attr_name));
28840 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
28842 PyTypeObject *tp = Py_TYPE(obj);
28843 if (unlikely(!PyString_Check(attr_name))) {
28844 return PyObject_GenericGetAttr(obj, attr_name);
28846 assert(!tp->tp_dictoffset);
28847 descr = _PyType_Lookup(tp, attr_name);
28848 if (unlikely(!descr)) {
28849 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
28852 #if PY_MAJOR_VERSION < 3
28853 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
28856 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
28858 PyObject *res = f(descr, obj, (PyObject *)tp);
28868 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
28869 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
28870 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
28871 return PyObject_GenericGetAttr(obj, attr_name);
28873 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
28878 static int __Pyx_SetVtable(PyObject *dict,
void *vtable) {
28879 #if PY_VERSION_HEX >= 0x02070000
28880 PyObject *ob = PyCapsule_New(vtable, 0, 0);
28882 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
28886 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
28896 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(
void) {
28897 __Pyx_PyThreadState_declare
28898 __Pyx_PyThreadState_assign
28899 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
28900 __Pyx_PyErr_Clear();
28902 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
28904 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
28905 PyTypeObject* tp = Py_TYPE(obj);
28906 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
28907 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
28910 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
28911 if (unlikely(!result)) {
28912 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
28918 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
28920 PyObject *name_attr;
28921 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
28922 if (likely(name_attr)) {
28923 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
28927 if (unlikely(ret < 0)) {
28931 Py_XDECREF(name_attr);
28934 static int __Pyx_setup_reduce(PyObject* type_obj) {
28936 PyObject *object_reduce = NULL;
28937 PyObject *object_getstate = NULL;
28938 PyObject *object_reduce_ex = NULL;
28939 PyObject *reduce = NULL;
28940 PyObject *reduce_ex = NULL;
28941 PyObject *reduce_cython = NULL;
28942 PyObject *setstate = NULL;
28943 PyObject *setstate_cython = NULL;
28944 PyObject *getstate = NULL;
28945 #if CYTHON_USE_PYTYPE_LOOKUP
28946 getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
28948 getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
28949 if (!getstate && PyErr_Occurred()) {
28954 #if CYTHON_USE_PYTYPE_LOOKUP
28955 object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
28957 object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
28958 if (!object_getstate && PyErr_Occurred()) {
28962 if (object_getstate != getstate) {
28966 #if CYTHON_USE_PYTYPE_LOOKUP
28967 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
28969 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
28971 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex);
if (unlikely(!reduce_ex))
goto __PYX_BAD;
28972 if (reduce_ex == object_reduce_ex) {
28973 #if CYTHON_USE_PYTYPE_LOOKUP
28974 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
28976 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
28978 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce);
if (unlikely(!reduce))
goto __PYX_BAD;
28979 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
28980 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
28981 if (likely(reduce_cython)) {
28982 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
28983 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
28984 }
else if (reduce == object_reduce || PyErr_Occurred()) {
28987 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
28988 if (!setstate) PyErr_Clear();
28989 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
28990 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
28991 if (likely(setstate_cython)) {
28992 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
28993 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
28994 }
else if (!setstate || PyErr_Occurred()) {
28998 PyType_Modified((PyTypeObject*)type_obj);
29003 if (!PyErr_Occurred())
29004 PyErr_Format(PyExc_RuntimeError,
"Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
29007 #if !CYTHON_USE_PYTYPE_LOOKUP
29008 Py_XDECREF(object_reduce);
29009 Py_XDECREF(object_reduce_ex);
29010 Py_XDECREF(object_getstate);
29011 Py_XDECREF(getstate);
29013 Py_XDECREF(reduce);
29014 Py_XDECREF(reduce_ex);
29015 Py_XDECREF(reduce_cython);
29016 Py_XDECREF(setstate);
29017 Py_XDECREF(setstate_cython);
29022 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
29023 PyObject* fake_module;
29024 PyTypeObject* cached_type = NULL;
29025 fake_module = PyImport_AddModule((
char*)
"_cython_" CYTHON_ABI);
29026 if (!fake_module)
return NULL;
29027 Py_INCREF(fake_module);
29028 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
29030 if (!PyType_Check((PyObject*)cached_type)) {
29031 PyErr_Format(PyExc_TypeError,
29032 "Shared Cython type %.200s is not a type object",
29036 if (cached_type->tp_basicsize != type->tp_basicsize) {
29037 PyErr_Format(PyExc_TypeError,
29038 "Shared Cython type %.200s has the wrong size, try recompiling",
29043 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
goto bad;
29045 if (PyType_Ready(type) < 0)
goto bad;
29046 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
29049 cached_type = type;
29052 Py_DECREF(fake_module);
29053 return cached_type;
29055 Py_XDECREF(cached_type);
29056 cached_type = NULL;
29061 #include <structmember.h>
29063 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *closure)
29065 if (unlikely(op->func_doc == NULL)) {
29066 if (op->func.m_ml->ml_doc) {
29067 #if PY_MAJOR_VERSION >= 3
29068 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
29070 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
29072 if (unlikely(op->func_doc == NULL))
29075 Py_INCREF(Py_None);
29079 Py_INCREF(op->func_doc);
29080 return op->func_doc;
29083 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
29085 PyObject *tmp = op->func_doc;
29086 if (value == NULL) {
29090 op->func_doc = value;
29095 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
29097 if (unlikely(op->func_name == NULL)) {
29098 #if PY_MAJOR_VERSION >= 3
29099 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
29101 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
29103 if (unlikely(op->func_name == NULL))
29106 Py_INCREF(op->func_name);
29107 return op->func_name;
29110 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
29113 #if PY_MAJOR_VERSION >= 3
29114 if (unlikely(value == NULL || !PyUnicode_Check(value)))
29116 if (unlikely(value == NULL || !PyString_Check(value)))
29119 PyErr_SetString(PyExc_TypeError,
29120 "__name__ must be set to a string object");
29123 tmp = op->func_name;
29125 op->func_name = value;
29130 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
29132 Py_INCREF(op->func_qualname);
29133 return op->func_qualname;
29136 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
29139 #if PY_MAJOR_VERSION >= 3
29140 if (unlikely(value == NULL || !PyUnicode_Check(value)))
29142 if (unlikely(value == NULL || !PyString_Check(value)))
29145 PyErr_SetString(PyExc_TypeError,
29146 "__qualname__ must be set to a string object");
29149 tmp = op->func_qualname;
29151 op->func_qualname = value;
29156 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED
void *closure)
29159 self = m->func_closure;
29166 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
29168 if (unlikely(op->func_dict == NULL)) {
29169 op->func_dict = PyDict_New();
29170 if (unlikely(op->func_dict == NULL))
29173 Py_INCREF(op->func_dict);
29174 return op->func_dict;
29177 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
29180 if (unlikely(value == NULL)) {
29181 PyErr_SetString(PyExc_TypeError,
29182 "function's dictionary may not be deleted");
29185 if (unlikely(!PyDict_Check(value))) {
29186 PyErr_SetString(PyExc_TypeError,
29187 "setting function's dictionary to a non-dict");
29190 tmp = op->func_dict;
29192 op->func_dict = value;
29197 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
29199 Py_INCREF(op->func_globals);
29200 return op->func_globals;
29203 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
29205 Py_INCREF(Py_None);
29209 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
29211 PyObject* result = (op->func_code) ? op->func_code : Py_None;
29216 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
29218 PyObject *res = op->defaults_getter((PyObject *) op);
29219 if (unlikely(!res))
29221 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
29222 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
29223 Py_INCREF(op->defaults_tuple);
29224 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
29225 Py_INCREF(op->defaults_kwdict);
29227 op->defaults_tuple = PySequence_ITEM(res, 0);
29228 if (unlikely(!op->defaults_tuple)) result = -1;
29230 op->defaults_kwdict = PySequence_ITEM(res, 1);
29231 if (unlikely(!op->defaults_kwdict)) result = -1;
29238 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
29242 }
else if (value != Py_None && !PyTuple_Check(value)) {
29243 PyErr_SetString(PyExc_TypeError,
29244 "__defaults__ must be set to a tuple object");
29248 tmp = op->defaults_tuple;
29249 op->defaults_tuple = value;
29254 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
29255 PyObject* result = op->defaults_tuple;
29256 if (unlikely(!result)) {
29257 if (op->defaults_getter) {
29258 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
29259 result = op->defaults_tuple;
29268 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
29272 }
else if (value != Py_None && !PyDict_Check(value)) {
29273 PyErr_SetString(PyExc_TypeError,
29274 "__kwdefaults__ must be set to a dict object");
29278 tmp = op->defaults_kwdict;
29279 op->defaults_kwdict = value;
29284 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
29285 PyObject* result = op->defaults_kwdict;
29286 if (unlikely(!result)) {
29287 if (op->defaults_getter) {
29288 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
29289 result = op->defaults_kwdict;
29298 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
29300 if (!value || value == Py_None) {
29302 }
else if (!PyDict_Check(value)) {
29303 PyErr_SetString(PyExc_TypeError,
29304 "__annotations__ must be set to a dict object");
29308 tmp = op->func_annotations;
29309 op->func_annotations = value;
29314 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
29315 PyObject* result = op->func_annotations;
29316 if (unlikely(!result)) {
29317 result = PyDict_New();
29318 if (unlikely(!result))
return NULL;
29319 op->func_annotations = result;
29324 static PyGetSetDef __pyx_CyFunction_getsets[] = {
29325 {(
char *)
"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
29326 {(
char *)
"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
29327 {(
char *)
"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
29328 {(
char *)
"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
29329 {(
char *)
"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
29330 {(
char *)
"__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
29331 {(
char *)
"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
29332 {(
char *)
"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
29333 {(
char *)
"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
29334 {(
char *)
"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
29335 {(
char *)
"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
29336 {(
char *)
"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
29337 {(
char *)
"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
29338 {(
char *)
"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
29339 {(
char *)
"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
29340 {(
char *)
"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
29341 {(
char *)
"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
29342 {(
char *)
"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
29345 static PyMemberDef __pyx_CyFunction_members[] = {
29346 {(
char *)
"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
29350 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
29352 #if PY_MAJOR_VERSION >= 3
29353 Py_INCREF(m->func_qualname);
29354 return m->func_qualname;
29356 return PyString_FromString(m->func.m_ml->ml_name);
29359 static PyMethodDef __pyx_CyFunction_methods[] = {
29360 {
"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
29363 #if PY_VERSION_HEX < 0x030500A0
29364 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
29366 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
29368 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml,
int flags, PyObject* qualname,
29369 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
29370 if (unlikely(op == NULL))
29373 __Pyx_CyFunction_weakreflist(op) = NULL;
29374 op->func.m_ml = ml;
29375 op->func.m_self = (PyObject *) op;
29376 Py_XINCREF(closure);
29377 op->func_closure = closure;
29378 Py_XINCREF(module);
29379 op->func.m_module = module;
29380 op->func_dict = NULL;
29381 op->func_name = NULL;
29382 Py_INCREF(qualname);
29383 op->func_qualname = qualname;
29384 op->func_doc = NULL;
29385 op->func_classobj = NULL;
29386 op->func_globals = globals;
29387 Py_INCREF(op->func_globals);
29389 op->func_code = code;
29390 op->defaults_pyobjects = 0;
29391 op->defaults_size = 0;
29392 op->defaults = NULL;
29393 op->defaults_tuple = NULL;
29394 op->defaults_kwdict = NULL;
29395 op->defaults_getter = NULL;
29396 op->func_annotations = NULL;
29397 return (PyObject *) op;
29400 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
29402 Py_CLEAR(m->func_closure);
29403 Py_CLEAR(m->func.m_module);
29404 Py_CLEAR(m->func_dict);
29405 Py_CLEAR(m->func_name);
29406 Py_CLEAR(m->func_qualname);
29407 Py_CLEAR(m->func_doc);
29408 Py_CLEAR(m->func_globals);
29409 Py_CLEAR(m->func_code);
29410 Py_CLEAR(m->func_classobj);
29411 Py_CLEAR(m->defaults_tuple);
29412 Py_CLEAR(m->defaults_kwdict);
29413 Py_CLEAR(m->func_annotations);
29415 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
29417 for (i = 0; i < m->defaults_pyobjects; i++)
29418 Py_XDECREF(pydefaults[i]);
29419 PyObject_Free(m->defaults);
29420 m->defaults = NULL;
29424 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
29426 if (__Pyx_CyFunction_weakreflist(m) != NULL)
29427 PyObject_ClearWeakRefs((PyObject *) m);
29428 __Pyx_CyFunction_clear(m);
29429 PyObject_GC_Del(m);
29431 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
29433 PyObject_GC_UnTrack(m);
29434 __Pyx__CyFunction_dealloc(m);
29436 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
void *arg)
29438 Py_VISIT(m->func_closure);
29439 Py_VISIT(m->func.m_module);
29440 Py_VISIT(m->func_dict);
29441 Py_VISIT(m->func_name);
29442 Py_VISIT(m->func_qualname);
29443 Py_VISIT(m->func_doc);
29444 Py_VISIT(m->func_globals);
29445 Py_VISIT(m->func_code);
29446 Py_VISIT(m->func_classobj);
29447 Py_VISIT(m->defaults_tuple);
29448 Py_VISIT(m->defaults_kwdict);
29450 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
29452 for (i = 0; i < m->defaults_pyobjects; i++)
29453 Py_VISIT(pydefaults[i]);
29457 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
29459 #if PY_MAJOR_VERSION < 3
29460 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29461 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
29465 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
29467 type = (PyObject *)(Py_TYPE(obj));
29468 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
29470 if (obj == Py_None)
29473 return __Pyx_PyMethod_New(func, obj, type);
29476 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
29478 #if PY_MAJOR_VERSION >= 3
29479 return PyUnicode_FromFormat(
"<cyfunction %U at %p>",
29480 op->func_qualname, (
void *)op);
29482 return PyString_FromFormat(
"<cyfunction %s at %p>",
29483 PyString_AsString(op->func_qualname), (
void *)op);
29486 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *
self, PyObject *arg, PyObject *kw) {
29487 PyCFunctionObject* f = (PyCFunctionObject*)func;
29488 PyCFunction meth = f->m_ml->ml_meth;
29490 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
29492 if (likely(kw == NULL || PyDict_Size(kw) == 0))
29493 return (*meth)(
self, arg);
29495 case METH_VARARGS | METH_KEYWORDS:
29496 return (*(PyCFunctionWithKeywords)(
void*)meth)(
self, arg, kw);
29498 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
29499 size = PyTuple_GET_SIZE(arg);
29500 if (likely(size == 0))
29501 return (*meth)(
self, NULL);
29502 PyErr_Format(PyExc_TypeError,
29503 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T
"d given)",
29504 f->m_ml->ml_name, size);
29509 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
29510 size = PyTuple_GET_SIZE(arg);
29511 if (likely(size == 1)) {
29512 PyObject *result, *arg0;
29513 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
29514 arg0 = PyTuple_GET_ITEM(arg, 0);
29516 arg0 = PySequence_ITEM(arg, 0);
if (unlikely(!arg0))
return NULL;
29518 result = (*meth)(
self, arg0);
29519 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
29524 PyErr_Format(PyExc_TypeError,
29525 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T
"d given)",
29526 f->m_ml->ml_name, size);
29531 PyErr_SetString(PyExc_SystemError,
"Bad call flags in "
29532 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
29533 "longer supported!");
29536 PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
29540 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
29541 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
29543 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
29545 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
29546 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
29548 PyObject *new_args;
29550 argc = PyTuple_GET_SIZE(args);
29551 new_args = PyTuple_GetSlice(args, 1, argc);
29552 if (unlikely(!new_args))
29554 self = PyTuple_GetItem(args, 0);
29555 if (unlikely(!
self)) {
29556 Py_DECREF(new_args);
29557 #if PY_MAJOR_VERSION > 2
29558 PyErr_Format(PyExc_TypeError,
29559 "unbound method %.200S() needs an argument",
29560 cyfunc->func_qualname);
29562 PyErr_SetString(PyExc_TypeError,
29563 "unbound method needs an argument");
29567 result = __Pyx_CyFunction_CallMethod(func,
self, new_args, kw);
29568 Py_DECREF(new_args);
29570 result = __Pyx_CyFunction_Call(func, args, kw);
29574 static PyTypeObject __pyx_CyFunctionType_type = {
29575 PyVarObject_HEAD_INIT(0, 0)
29576 "cython_function_or_method",
29577 sizeof(__pyx_CyFunctionObject),
29579 (destructor) __Pyx_CyFunction_dealloc,
29583 #if PY_MAJOR_VERSION < 3
29588 (reprfunc) __Pyx_CyFunction_repr,
29593 __Pyx_CyFunction_CallAsMethod,
29598 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
29600 (traverseproc) __Pyx_CyFunction_traverse,
29601 (inquiry) __Pyx_CyFunction_clear,
29603 #
if PY_VERSION_HEX < 0x030500A0
29604 offsetof(__pyx_CyFunctionObject, func_weakreflist),
29606 offsetof(PyCFunctionObject, m_weakreflist),
29610 __pyx_CyFunction_methods,
29611 __pyx_CyFunction_members,
29612 __pyx_CyFunction_getsets,
29615 __Pyx_CyFunction_descr_get,
29617 offsetof(__pyx_CyFunctionObject, func_dict),
29630 #if PY_VERSION_HEX >= 0x030400a1
29633 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
29636 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
29639 #if PY_VERSION_HEX >= 0x030C0000
29642 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
29646 static int __pyx_CyFunction_init(
void) {
29647 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
29648 if (unlikely(__pyx_CyFunctionType == NULL)) {
29653 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *func,
size_t size,
int pyobjects) {
29654 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29655 m->defaults = PyObject_Malloc(size);
29656 if (unlikely(!m->defaults))
29657 return PyErr_NoMemory();
29658 memset(m->defaults, 0, size);
29659 m->defaults_pyobjects = pyobjects;
29660 m->defaults_size = size;
29661 return m->defaults;
29663 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
29664 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29665 m->defaults_tuple = tuple;
29668 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
29669 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29670 m->defaults_kwdict = dict;
29673 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
29674 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29675 m->func_annotations = dict;
29680 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
int flags, PyObject* qualname,
29681 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
29682 PyObject *op = __Pyx_CyFunction_Init(
29683 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
29684 ml, flags, qualname, closure, module, globals, code
29687 PyObject_GC_Track(op);
29693 #ifndef CYTHON_CLINE_IN_TRACEBACK
29694 static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate,
int c_line) {
29695 PyObject *use_cline;
29696 PyObject *ptype, *pvalue, *ptraceback;
29697 #if CYTHON_COMPILING_IN_CPYTHON
29698 PyObject **cython_runtime_dict;
29700 if (unlikely(!__pyx_cython_runtime)) {
29703 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
29704 #if CYTHON_COMPILING_IN_CPYTHON
29705 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
29706 if (likely(cython_runtime_dict)) {
29707 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
29708 use_cline, *cython_runtime_dict,
29709 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
29713 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
29714 if (use_cline_obj) {
29715 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
29716 Py_DECREF(use_cline_obj);
29724 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
29726 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
29729 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
29735 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
29736 int start = 0, mid = 0, end = count - 1;
29737 if (end >= 0 && code_line > entries[end].code_line) {
29740 while (start < end) {
29741 mid = start + (end - start) / 2;
29742 if (code_line < entries[mid].code_line) {
29744 }
else if (code_line > entries[mid].code_line) {
29750 if (code_line <= entries[mid].code_line) {
29756 static PyCodeObject *__pyx_find_code_object(
int code_line) {
29757 PyCodeObject* code_object;
29759 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
29762 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
29763 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
29766 code_object = __pyx_code_cache.entries[pos].code_object;
29767 Py_INCREF(code_object);
29768 return code_object;
29770 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
29772 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
29773 if (unlikely(!code_line)) {
29776 if (unlikely(!entries)) {
29777 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
29778 if (likely(entries)) {
29779 __pyx_code_cache.entries = entries;
29780 __pyx_code_cache.max_count = 64;
29781 __pyx_code_cache.count = 1;
29782 entries[0].code_line = code_line;
29783 entries[0].code_object = code_object;
29784 Py_INCREF(code_object);
29788 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
29789 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
29790 PyCodeObject* tmp = entries[pos].code_object;
29791 entries[pos].code_object = code_object;
29795 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
29796 int new_max = __pyx_code_cache.max_count + 64;
29797 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
29798 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
29799 if (unlikely(!entries)) {
29802 __pyx_code_cache.entries = entries;
29803 __pyx_code_cache.max_count = new_max;
29805 for (i=__pyx_code_cache.count; i>pos; i--) {
29806 entries[i] = entries[i-1];
29808 entries[pos].code_line = code_line;
29809 entries[pos].code_object = code_object;
29810 __pyx_code_cache.count++;
29811 Py_INCREF(code_object);
29815 #include "compile.h"
29816 #include "frameobject.h"
29817 #include "traceback.h"
29818 #if PY_VERSION_HEX >= 0x030b00a6
29819 #ifndef Py_BUILD_CORE
29820 #define Py_BUILD_CORE 1
29822 #include "internal/pycore_frame.h"
29824 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
29825 const char *funcname,
int c_line,
29826 int py_line,
const char *filename) {
29827 PyCodeObject *py_code = NULL;
29828 PyObject *py_funcname = NULL;
29829 #if PY_MAJOR_VERSION < 3
29830 PyObject *py_srcfile = NULL;
29831 py_srcfile = PyString_FromString(filename);
29832 if (!py_srcfile)
goto bad;
29835 #if PY_MAJOR_VERSION < 3
29836 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
29837 if (!py_funcname)
goto bad;
29839 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
29840 if (!py_funcname)
goto bad;
29841 funcname = PyUnicode_AsUTF8(py_funcname);
29842 if (!funcname)
goto bad;
29846 #if PY_MAJOR_VERSION < 3
29847 py_funcname = PyString_FromString(funcname);
29848 if (!py_funcname)
goto bad;
29851 #if PY_MAJOR_VERSION < 3
29852 py_code = __Pyx_PyCode_New(
29869 Py_DECREF(py_srcfile);
29871 py_code = PyCode_NewEmpty(filename, funcname, py_line);
29873 Py_XDECREF(py_funcname);
29876 Py_XDECREF(py_funcname);
29877 #if PY_MAJOR_VERSION < 3
29878 Py_XDECREF(py_srcfile);
29882 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
29883 int py_line,
const char *filename) {
29884 PyCodeObject *py_code = 0;
29885 PyFrameObject *py_frame = 0;
29886 PyThreadState *tstate = __Pyx_PyThreadState_Current;
29887 PyObject *ptype, *pvalue, *ptraceback;
29889 c_line = __Pyx_CLineForTraceback(tstate, c_line);
29891 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
29893 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
29894 py_code = __Pyx_CreateCodeObjectForTraceback(
29895 funcname, c_line, py_line, filename);
29900 Py_XDECREF(pvalue);
29901 Py_XDECREF(ptraceback);
29904 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
29905 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
29907 py_frame = PyFrame_New(
29913 if (!py_frame)
goto bad;
29914 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
29915 PyTraceBack_Here(py_frame);
29917 Py_XDECREF(py_code);
29918 Py_XDECREF(py_frame);
29921 #if PY_MAJOR_VERSION < 3
29922 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags) {
29923 if (PyObject_CheckBuffer(obj))
return PyObject_GetBuffer(obj, view, flags);
29924 if (__Pyx_TypeCheck(obj, __pyx_array_type))
return __pyx_array_getbuffer(obj, view, flags);
29925 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type))
return __pyx_memoryview_getbuffer(obj, view, flags);
29926 PyErr_Format(PyExc_TypeError,
"'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
29929 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
29930 PyObject *obj = view->obj;
29932 if (PyObject_CheckBuffer(obj)) {
29933 PyBuffer_Release(view);
29945 __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim)
29947 int i, index, step, start;
29948 Py_ssize_t itemsize = mvs.memview->view.itemsize;
29949 if (order ==
'F') {
29956 for (i = 0; i < ndim; i++) {
29957 index = start + step * i;
29958 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
29960 itemsize *= mvs.shape[index];
29967 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
29968 void **out_start,
void **out_end,
29969 int ndim,
size_t itemsize)
29973 start = end = slice->data;
29974 for (i = 0; i < ndim; i++) {
29975 Py_ssize_t stride = slice->strides[i];
29976 Py_ssize_t extent = slice->shape[i];
29978 *out_start = *out_end = start;
29982 end += stride * (extent - 1);
29984 start += stride * (extent - 1);
29987 *out_start = start;
29988 *out_end = end + itemsize;
29991 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
29992 __Pyx_memviewslice *slice2,
29993 int ndim,
size_t itemsize)
29995 void *start1, *end1, *start2, *end2;
29996 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
29997 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
29998 return (start1 < end2) && (start2 < end1);
30002 static CYTHON_INLINE PyObject *
30003 __pyx_capsule_create(
void *p, CYTHON_UNUSED
const char *sig)
30006 #if PY_VERSION_HEX >= 0x02070000
30007 cobj = PyCapsule_New(p, sig, NULL);
30009 cobj = PyCObject_FromVoidPtr(p, NULL);
30015 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void)
30021 S.u32 = 0x01020304;
30022 return S.u8[0] == 4;
30026 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
30027 __Pyx_BufFmt_StackElem* stack,
30028 __Pyx_TypeInfo* type) {
30029 stack[0].field = &ctx->root;
30030 stack[0].parent_offset = 0;
30031 ctx->root.type = type;
30032 ctx->root.name =
"buffer dtype";
30033 ctx->root.offset = 0;
30035 ctx->head->field = &ctx->root;
30036 ctx->fmt_offset = 0;
30037 ctx->head->parent_offset = 0;
30038 ctx->new_packmode =
'@';
30039 ctx->enc_packmode =
'@';
30040 ctx->new_count = 1;
30041 ctx->enc_count = 0;
30043 ctx->is_complex = 0;
30044 ctx->is_valid_array = 0;
30045 ctx->struct_alignment = 0;
30046 while (type->typegroup ==
'S') {
30048 ctx->head->field = type->fields;
30049 ctx->head->parent_offset = 0;
30050 type = type->fields->type;
30053 static int __Pyx_BufFmt_ParseNumber(
const char** ts) {
30055 const char* t = *ts;
30056 if (*t < '0' || *t >
'9') {
30059 count = *t++ -
'0';
30060 while (*t >=
'0' && *t <=
'9') {
30062 count += *t++ -
'0';
30068 static int __Pyx_BufFmt_ExpectNumber(
const char **ts) {
30069 int number = __Pyx_BufFmt_ParseNumber(ts);
30071 PyErr_Format(PyExc_ValueError,\
30072 "Does not understand character buffer dtype format string ('%c')", **ts);
30075 static void __Pyx_BufFmt_RaiseUnexpectedChar(
char ch) {
30076 PyErr_Format(PyExc_ValueError,
30077 "Unexpected format string character: '%c'", ch);
30079 static const char* __Pyx_BufFmt_DescribeTypeChar(
char ch,
int is_complex) {
30081 case '?':
return "'bool'";
30082 case 'c':
return "'char'";
30083 case 'b':
return "'signed char'";
30084 case 'B':
return "'unsigned char'";
30085 case 'h':
return "'short'";
30086 case 'H':
return "'unsigned short'";
30087 case 'i':
return "'int'";
30088 case 'I':
return "'unsigned int'";
30089 case 'l':
return "'long'";
30090 case 'L':
return "'unsigned long'";
30091 case 'q':
return "'long long'";
30092 case 'Q':
return "'unsigned long long'";
30093 case 'f':
return (is_complex ?
"'complex float'" :
"'float'");
30094 case 'd':
return (is_complex ?
"'complex double'" :
"'double'");
30095 case 'g':
return (is_complex ?
"'complex long double'" :
"'long double'");
30096 case 'T':
return "a struct";
30097 case 'O':
return "Python object";
30098 case 'P':
return "a pointer";
30099 case 's':
case 'p':
return "a string";
30100 case 0:
return "end";
30101 default:
return "unparseable format string";
30104 static size_t __Pyx_BufFmt_TypeCharToStandardSize(
char ch,
int is_complex) {
30106 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
30107 case 'h':
case 'H':
return 2;
30108 case 'i':
case 'I':
case 'l':
case 'L':
return 4;
30109 case 'q':
case 'Q':
return 8;
30110 case 'f':
return (is_complex ? 8 : 4);
30111 case 'd':
return (is_complex ? 16 : 8);
30113 PyErr_SetString(PyExc_ValueError,
"Python does not define a standard format string size for long double ('g')..");
30116 case 'O':
case 'P':
return sizeof(
void*);
30118 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30122 static size_t __Pyx_BufFmt_TypeCharToNativeSize(
char ch,
int is_complex) {
30124 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
30125 case 'h':
case 'H':
return sizeof(short);
30126 case 'i':
case 'I':
return sizeof(int);
30127 case 'l':
case 'L':
return sizeof(long);
30128 #ifdef HAVE_LONG_LONG
30129 case 'q':
case 'Q':
return sizeof(PY_LONG_LONG);
30131 case 'f':
return sizeof(float) * (is_complex ? 2 : 1);
30132 case 'd':
return sizeof(double) * (is_complex ? 2 : 1);
30133 case 'g':
return sizeof(
long double) * (is_complex ? 2 : 1);
30134 case 'O':
case 'P':
return sizeof(
void*);
30136 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30141 typedef struct {
char c;
short x; } __Pyx_st_short;
30142 typedef struct {
char c;
int x; } __Pyx_st_int;
30143 typedef struct {
char c;
long x; } __Pyx_st_long;
30144 typedef struct {
char c;
float x; } __Pyx_st_float;
30145 typedef struct {
char c;
double x; } __Pyx_st_double;
30146 typedef struct {
char c;
long double x; } __Pyx_st_longdouble;
30147 typedef struct {
char c;
void *x; } __Pyx_st_void_p;
30148 #ifdef HAVE_LONG_LONG
30149 typedef struct {
char c; PY_LONG_LONG x; } __Pyx_st_longlong;
30151 static size_t __Pyx_BufFmt_TypeCharToAlignment(
char ch, CYTHON_UNUSED
int is_complex) {
30153 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
30154 case 'h':
case 'H':
return sizeof(__Pyx_st_short) -
sizeof(
short);
30155 case 'i':
case 'I':
return sizeof(__Pyx_st_int) -
sizeof(
int);
30156 case 'l':
case 'L':
return sizeof(__Pyx_st_long) -
sizeof(
long);
30157 #ifdef HAVE_LONG_LONG
30158 case 'q':
case 'Q':
return sizeof(__Pyx_st_longlong) -
sizeof(PY_LONG_LONG);
30160 case 'f':
return sizeof(__Pyx_st_float) -
sizeof(
float);
30161 case 'd':
return sizeof(__Pyx_st_double) -
sizeof(
double);
30162 case 'g':
return sizeof(__Pyx_st_longdouble) -
sizeof(
long double);
30163 case 'P':
case 'O':
return sizeof(__Pyx_st_void_p) -
sizeof(
void*);
30165 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30173 typedef struct {
short x;
char c; } __Pyx_pad_short;
30174 typedef struct {
int x;
char c; } __Pyx_pad_int;
30175 typedef struct {
long x;
char c; } __Pyx_pad_long;
30176 typedef struct {
float x;
char c; } __Pyx_pad_float;
30177 typedef struct {
double x;
char c; } __Pyx_pad_double;
30178 typedef struct {
long double x;
char c; } __Pyx_pad_longdouble;
30179 typedef struct {
void *x;
char c; } __Pyx_pad_void_p;
30180 #ifdef HAVE_LONG_LONG
30181 typedef struct { PY_LONG_LONG x;
char c; } __Pyx_pad_longlong;
30183 static size_t __Pyx_BufFmt_TypeCharToPadding(
char ch, CYTHON_UNUSED
int is_complex) {
30185 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
30186 case 'h':
case 'H':
return sizeof(__Pyx_pad_short) -
sizeof(
short);
30187 case 'i':
case 'I':
return sizeof(__Pyx_pad_int) -
sizeof(
int);
30188 case 'l':
case 'L':
return sizeof(__Pyx_pad_long) -
sizeof(
long);
30189 #ifdef HAVE_LONG_LONG
30190 case 'q':
case 'Q':
return sizeof(__Pyx_pad_longlong) -
sizeof(PY_LONG_LONG);
30192 case 'f':
return sizeof(__Pyx_pad_float) -
sizeof(
float);
30193 case 'd':
return sizeof(__Pyx_pad_double) -
sizeof(
double);
30194 case 'g':
return sizeof(__Pyx_pad_longdouble) -
sizeof(
long double);
30195 case 'P':
case 'O':
return sizeof(__Pyx_pad_void_p) -
sizeof(
void*);
30197 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30201 static char __Pyx_BufFmt_TypeCharToGroup(
char ch,
int is_complex) {
30205 case 'b':
case 'h':
case 'i':
30206 case 'l':
case 'q':
case 's':
case 'p':
30208 case '?':
case 'B':
case 'H':
case 'I':
case 'L':
case 'Q':
30210 case 'f':
case 'd':
case 'g':
30211 return (is_complex ?
'C' :
'R');
30217 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30222 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
30223 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
30224 const char* expected;
30226 if (ctx->head == NULL) {
30230 expected = ctx->head->field->type->name;
30233 PyErr_Format(PyExc_ValueError,
30234 "Buffer dtype mismatch, expected %s%s%s but got %s",
30235 quote, expected, quote,
30236 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
30238 __Pyx_StructField* field = ctx->head->field;
30239 __Pyx_StructField* parent = (ctx->head - 1)->field;
30240 PyErr_Format(PyExc_ValueError,
30241 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
30242 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
30243 parent->type->name, field->name);
30246 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
30248 size_t size, offset, arraysize = 1;
30249 if (ctx->enc_type == 0)
return 0;
30250 if (ctx->head->field->type->arraysize[0]) {
30252 if (ctx->enc_type ==
's' || ctx->enc_type ==
'p') {
30253 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
30255 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
30256 PyErr_Format(PyExc_ValueError,
30257 "Expected a dimension of size %zu, got %zu",
30258 ctx->head->field->type->arraysize[0], ctx->enc_count);
30262 if (!ctx->is_valid_array) {
30263 PyErr_Format(PyExc_ValueError,
"Expected %d dimensions, got %d",
30264 ctx->head->field->type->ndim, ndim);
30267 for (i = 0; i < ctx->head->field->type->ndim; i++) {
30268 arraysize *= ctx->head->field->type->arraysize[i];
30270 ctx->is_valid_array = 0;
30271 ctx->enc_count = 1;
30273 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
30275 __Pyx_StructField* field = ctx->head->field;
30276 __Pyx_TypeInfo* type = field->type;
30277 if (ctx->enc_packmode ==
'@' || ctx->enc_packmode ==
'^') {
30278 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
30280 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
30282 if (ctx->enc_packmode ==
'@') {
30283 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
30284 size_t align_mod_offset;
30285 if (align_at == 0)
return -1;
30286 align_mod_offset = ctx->fmt_offset % align_at;
30287 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
30288 if (ctx->struct_alignment == 0)
30289 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
30292 if (type->size != size || type->typegroup != group) {
30293 if (type->typegroup ==
'C' && type->fields != NULL) {
30294 size_t parent_offset = ctx->head->parent_offset + field->offset;
30296 ctx->head->field = type->fields;
30297 ctx->head->parent_offset = parent_offset;
30300 if ((type->typegroup ==
'H' || group ==
'H') && type->size == size) {
30302 __Pyx_BufFmt_RaiseExpected(ctx);
30306 offset = ctx->head->parent_offset + field->offset;
30307 if (ctx->fmt_offset != offset) {
30308 PyErr_Format(PyExc_ValueError,
30309 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T
"d but %" CYTHON_FORMAT_SSIZE_T
"d expected",
30310 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
30313 ctx->fmt_offset += size;
30315 ctx->fmt_offset += (arraysize - 1) * size;
30318 if (field == &ctx->root) {
30320 if (ctx->enc_count != 0) {
30321 __Pyx_BufFmt_RaiseExpected(ctx);
30326 ctx->head->field = ++field;
30327 if (field->type == NULL) {
30329 field = ctx->head->field;
30331 }
else if (field->type->typegroup ==
'S') {
30332 size_t parent_offset = ctx->head->parent_offset + field->offset;
30333 if (field->type->fields->type == NULL)
continue;
30334 field = field->type->fields;
30336 ctx->head->field = field;
30337 ctx->head->parent_offset = parent_offset;
30343 }
while (ctx->enc_count);
30345 ctx->is_complex = 0;
30349 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx,
const char** tsp)
30351 const char *ts = *tsp;
30352 int i = 0, number, ndim;
30354 if (ctx->new_count != 1) {
30355 PyErr_SetString(PyExc_ValueError,
30356 "Cannot handle repeated arrays in format string");
30359 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
30360 ndim = ctx->head->field->type->ndim;
30361 while (*ts && *ts !=
')') {
30363 case ' ':
case '\f':
case '\r':
case '\n':
case '\t':
case '\v':
continue;
30366 number = __Pyx_BufFmt_ExpectNumber(&ts);
30367 if (number == -1)
return NULL;
30368 if (i < ndim && (
size_t) number != ctx->head->field->type->arraysize[i])
30369 return PyErr_Format(PyExc_ValueError,
30370 "Expected a dimension of size %zu, got %d",
30371 ctx->head->field->type->arraysize[i], number);
30372 if (*ts !=
',' && *ts !=
')')
30373 return PyErr_Format(PyExc_ValueError,
30374 "Expected a comma in format string, got '%c'", *ts);
30375 if (*ts ==
',') ts++;
30379 return PyErr_Format(PyExc_ValueError,
"Expected %d dimension(s), got %d",
30380 ctx->head->field->type->ndim, i);
30382 PyErr_SetString(PyExc_ValueError,
30383 "Unexpected end of format string, expected ')'");
30386 ctx->is_valid_array = 1;
30387 ctx->new_count = 1;
30391 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts) {
30396 if (ctx->enc_type != 0 && ctx->head == NULL) {
30397 __Pyx_BufFmt_RaiseExpected(ctx);
30400 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
30401 if (ctx->head != NULL) {
30402 __Pyx_BufFmt_RaiseExpected(ctx);
30412 if (!__Pyx_Is_Little_Endian()) {
30413 PyErr_SetString(PyExc_ValueError,
"Little-endian buffer not supported on big-endian compiler");
30416 ctx->new_packmode =
'=';
30421 if (__Pyx_Is_Little_Endian()) {
30422 PyErr_SetString(PyExc_ValueError,
"Big-endian buffer not supported on little-endian compiler");
30425 ctx->new_packmode =
'=';
30431 ctx->new_packmode = *ts++;
30435 const char* ts_after_sub;
30436 size_t i, struct_count = ctx->new_count;
30437 size_t struct_alignment = ctx->struct_alignment;
30438 ctx->new_count = 1;
30441 PyErr_SetString(PyExc_ValueError,
"Buffer acquisition: Expected '{' after 'T'");
30444 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
30446 ctx->enc_count = 0;
30447 ctx->struct_alignment = 0;
30450 for (i = 0; i != struct_count; ++i) {
30451 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
30452 if (!ts_after_sub)
return NULL;
30455 if (struct_alignment) ctx->struct_alignment = struct_alignment;
30460 size_t alignment = ctx->struct_alignment;
30462 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
30464 if (alignment && ctx->fmt_offset % alignment) {
30465 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
30470 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
30471 ctx->fmt_offset += ctx->new_count;
30472 ctx->new_count = 1;
30473 ctx->enc_count = 0;
30475 ctx->enc_packmode = ctx->new_packmode;
30481 if (*ts !=
'f' && *ts !=
'd' && *ts !=
'g') {
30482 __Pyx_BufFmt_RaiseUnexpectedChar(
'Z');
30485 CYTHON_FALLTHROUGH;
30486 case '?':
case 'c':
case 'b':
case 'B':
case 'h':
case 'H':
case 'i':
case 'I':
30487 case 'l':
case 'L':
case 'q':
case 'Q':
30488 case 'f':
case 'd':
case 'g':
30489 case 'O':
case 'p':
30490 if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
30491 (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
30492 ctx->enc_count += ctx->new_count;
30493 ctx->new_count = 1;
30498 CYTHON_FALLTHROUGH;
30500 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
30501 ctx->enc_count = ctx->new_count;
30502 ctx->enc_packmode = ctx->new_packmode;
30503 ctx->enc_type = *ts;
30504 ctx->is_complex = got_Z;
30506 ctx->new_count = 1;
30511 while(*ts !=
':') ++ts;
30515 if (!__pyx_buffmt_parse_array(ctx, &ts))
return NULL;
30519 int number = __Pyx_BufFmt_ExpectNumber(&ts);
30520 if (number == -1)
return NULL;
30521 ctx->new_count = (size_t)number;
30529 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
30536 if (a->size != b->size || a->typegroup != b->typegroup ||
30537 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
30538 if (a->typegroup ==
'H' || b->typegroup ==
'H') {
30539 return a->size == b->size;
30545 for (i = 0; i < a->ndim; i++)
30546 if (a->arraysize[i] != b->arraysize[i])
30549 if (a->typegroup ==
'S') {
30550 if (a->flags != b->flags)
30552 if (a->fields || b->fields) {
30553 if (!(a->fields && b->fields))
30555 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
30556 __Pyx_StructField *field_a = a->fields + i;
30557 __Pyx_StructField *field_b = b->fields + i;
30558 if (field_a->offset != field_b->offset ||
30559 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
30562 return !a->fields[i].type && !b->fields[i].type;
30570 __pyx_check_strides(Py_buffer *buf,
int dim,
int ndim,
int spec)
30572 if (buf->shape[dim] <= 1)
30574 if (buf->strides) {
30575 if (spec & __Pyx_MEMVIEW_CONTIG) {
30576 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
30577 if (unlikely(buf->strides[dim] !=
sizeof(
void *))) {
30578 PyErr_Format(PyExc_ValueError,
30579 "Buffer is not indirectly contiguous "
30580 "in dimension %d.", dim);
30583 }
else if (unlikely(buf->strides[dim] != buf->itemsize)) {
30584 PyErr_SetString(PyExc_ValueError,
30585 "Buffer and memoryview are not contiguous "
30586 "in the same dimension.");
30590 if (spec & __Pyx_MEMVIEW_FOLLOW) {
30591 Py_ssize_t stride = buf->strides[dim];
30594 if (unlikely(stride < buf->itemsize)) {
30595 PyErr_SetString(PyExc_ValueError,
30596 "Buffer and memoryview are not contiguous "
30597 "in the same dimension.");
30602 if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
30603 PyErr_Format(PyExc_ValueError,
30604 "C-contiguous buffer is not contiguous in "
30605 "dimension %d", dim);
30607 }
else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
30608 PyErr_Format(PyExc_ValueError,
30609 "C-contiguous buffer is not indirect in "
30610 "dimension %d", dim);
30612 }
else if (unlikely(buf->suboffsets)) {
30613 PyErr_SetString(PyExc_ValueError,
30614 "Buffer exposes suboffsets but no strides");
30623 __pyx_check_suboffsets(Py_buffer *buf,
int dim, CYTHON_UNUSED
int ndim,
int spec)
30625 if (spec & __Pyx_MEMVIEW_DIRECT) {
30626 if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
30627 PyErr_Format(PyExc_ValueError,
30628 "Buffer not compatible with direct access "
30629 "in dimension %d.", dim);
30633 if (spec & __Pyx_MEMVIEW_PTR) {
30634 if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
30635 PyErr_Format(PyExc_ValueError,
30636 "Buffer is not indirectly accessible "
30637 "in dimension %d.", dim);
30646 __pyx_verify_contig(Py_buffer *buf,
int ndim,
int c_or_f_flag)
30649 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
30650 Py_ssize_t stride = 1;
30651 for (i = 0; i < ndim; i++) {
30652 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
30653 PyErr_SetString(PyExc_ValueError,
30654 "Buffer not fortran contiguous.");
30657 stride = stride * buf->shape[i];
30659 }
else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
30660 Py_ssize_t stride = 1;
30661 for (i = ndim - 1; i >- 1; i--) {
30662 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
30663 PyErr_SetString(PyExc_ValueError,
30664 "Buffer not C contiguous.");
30667 stride = stride * buf->shape[i];
30674 static int __Pyx_ValidateAndInit_memviewslice(
30679 __Pyx_TypeInfo *dtype,
30680 __Pyx_BufFmt_StackElem stack[],
30681 __Pyx_memviewslice *memviewslice,
30682 PyObject *original_obj)
30684 struct __pyx_memoryview_obj *memview, *new_memview;
30685 __Pyx_RefNannyDeclarations
30687 int i, spec = 0, retval = -1;
30688 __Pyx_BufFmt_Context ctx;
30689 int from_memoryview = __pyx_memoryview_check(original_obj);
30690 __Pyx_RefNannySetupContext(
"ValidateAndInit_memviewslice", 0);
30691 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((
struct __pyx_memoryview_obj *)
30692 original_obj)->typeinfo)) {
30693 memview = (
struct __pyx_memoryview_obj *) original_obj;
30694 new_memview = NULL;
30696 memview = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
30697 original_obj, buf_flags, 0, dtype);
30698 new_memview = memview;
30699 if (unlikely(!memview))
30702 buf = &memview->view;
30703 if (unlikely(buf->ndim != ndim)) {
30704 PyErr_Format(PyExc_ValueError,
30705 "Buffer has wrong number of dimensions (expected %d, got %d)",
30710 __Pyx_BufFmt_Init(&ctx, stack, dtype);
30711 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format)))
goto fail;
30713 if (unlikely((
unsigned) buf->itemsize != dtype->size)) {
30714 PyErr_Format(PyExc_ValueError,
30715 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T
"u byte%s) "
30716 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T
"u byte%s)",
30718 (buf->itemsize > 1) ?
"s" :
"",
30721 (dtype->size > 1) ?
"s" :
"");
30724 if (buf->len > 0) {
30725 for (i = 0; i < ndim; i++) {
30726 spec = axes_specs[i];
30727 if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
30729 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
30732 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
30735 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
30736 new_memview != NULL) == -1)) {
30742 Py_XDECREF(new_memview);
30745 __Pyx_RefNannyFinishContext();
30750 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__float(PyObject *obj,
int writable_flag) {
30751 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
30752 __Pyx_BufFmt_StackElem stack[1];
30753 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
30755 if (obj == Py_None) {
30756 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
30759 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
30760 (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
30761 &__Pyx_TypeInfo_float, stack,
30763 if (unlikely(retcode == -1))
30767 result.memview = NULL;
30768 result.data = NULL;
30773 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
30774 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
30775 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
30776 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
30777 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
30779 func_type value = func_value;\
30780 if (sizeof(target_type) < sizeof(func_type)) {\
30781 if (unlikely(value != (func_type) (target_type) value)) {\
30782 func_type zero = 0;\
30783 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
30784 return (target_type) -1;\
30785 if (is_unsigned && unlikely(value < zero))\
30786 goto raise_neg_overflow;\
30788 goto raise_overflow;\
30791 return (target_type) value;\
30795 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__double(PyObject *obj,
int writable_flag) {
30796 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
30797 __Pyx_BufFmt_StackElem stack[1];
30798 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
30800 if (obj == Py_None) {
30801 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
30804 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
30805 (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
30806 &__Pyx_TypeInfo_double, stack,
30808 if (unlikely(retcode == -1))
30812 result.memview = NULL;
30813 result.data = NULL;
30818 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj,
int writable_flag) {
30819 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
30820 __Pyx_BufFmt_StackElem stack[1];
30821 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
30823 if (obj == Py_None) {
30824 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
30827 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
30828 PyBUF_RECORDS_RO | writable_flag, 1,
30829 &__Pyx_TypeInfo_float, stack,
30831 if (unlikely(retcode == -1))
30835 result.memview = NULL;
30836 result.data = NULL;
30841 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj,
int writable_flag) {
30842 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
30843 __Pyx_BufFmt_StackElem stack[1];
30844 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
30846 if (obj == Py_None) {
30847 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
30850 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
30851 PyBUF_RECORDS_RO | writable_flag, 1,
30852 &__Pyx_TypeInfo_double, stack,
30854 if (unlikely(retcode == -1))
30858 result.memview = NULL;
30859 result.data = NULL;
30864 static __Pyx_memviewslice
30865 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
30866 const char *mode,
int ndim,
30867 size_t sizeof_dtype,
int contig_flag,
30868 int dtype_is_object)
30870 __Pyx_RefNannyDeclarations
30872 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
30873 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
30874 Py_buffer *buf = &from_memview->view;
30875 PyObject *shape_tuple = NULL;
30876 PyObject *temp_int = NULL;
30877 struct __pyx_array_obj *array_obj = NULL;
30878 struct __pyx_memoryview_obj *memview_obj = NULL;
30879 __Pyx_RefNannySetupContext(
"__pyx_memoryview_copy_new_contig", 0);
30880 for (i = 0; i < ndim; i++) {
30881 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
30882 PyErr_Format(PyExc_ValueError,
"Cannot copy memoryview slice with "
30883 "indirect dimensions (axis %d)", i);
30887 shape_tuple = PyTuple_New(ndim);
30888 if (unlikely(!shape_tuple)) {
30891 __Pyx_GOTREF(shape_tuple);
30892 for(i = 0; i < ndim; i++) {
30893 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
30894 if(unlikely(!temp_int)) {
30897 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
30901 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (
char *) mode, NULL);
30902 if (unlikely(!array_obj)) {
30905 __Pyx_GOTREF(array_obj);
30906 memview_obj = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
30907 (PyObject *) array_obj, contig_flag,
30909 from_mvs->memview->typeinfo);
30910 if (unlikely(!memview_obj))
30912 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
30914 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
30915 dtype_is_object) < 0))
30919 __Pyx_XDECREF(new_mvs.memview);
30920 new_mvs.memview = NULL;
30921 new_mvs.data = NULL;
30923 __Pyx_XDECREF(shape_tuple);
30924 __Pyx_XDECREF(temp_int);
30925 __Pyx_XDECREF(array_obj);
30926 __Pyx_RefNannyFinishContext();
30931 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
30932 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
30933 #pragma GCC diagnostic push
30934 #pragma GCC diagnostic ignored "-Wconversion"
30936 const long neg_one = (long) -1, const_zero = (
long) 0;
30937 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
30938 #pragma GCC diagnostic pop
30940 const int is_unsigned = neg_one > const_zero;
30942 if (
sizeof(
long) <
sizeof(long)) {
30943 return PyInt_FromLong((
long) value);
30944 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
30945 return PyLong_FromUnsignedLong((
unsigned long) value);
30946 #ifdef HAVE_LONG_LONG
30947 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
30948 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
30952 if (
sizeof(
long) <=
sizeof(
long)) {
30953 return PyInt_FromLong((
long) value);
30954 #ifdef HAVE_LONG_LONG
30955 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
30956 return PyLong_FromLongLong((PY_LONG_LONG) value);
30961 int one = 1;
int little = (int)*(
unsigned char *)&one;
30962 unsigned char *bytes = (
unsigned char *)&value;
30963 return _PyLong_FromByteArray(bytes,
sizeof(
long),
30964 little, !is_unsigned);
30969 static CYTHON_INLINE
LongIndexType __Pyx_PyInt_As_LongIndexType(PyObject *x) {
30970 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
30971 #pragma GCC diagnostic push
30972 #pragma GCC diagnostic ignored "-Wconversion"
30975 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
30976 #pragma GCC diagnostic pop
30978 const int is_unsigned = neg_one > const_zero;
30979 #if PY_MAJOR_VERSION < 3
30980 if (likely(PyInt_Check(x))) {
30982 __PYX_VERIFY_RETURN_INT(
LongIndexType,
long, PyInt_AS_LONG(x))
30984 long val = PyInt_AS_LONG(x);
30985 if (is_unsigned && unlikely(val < 0)) {
30986 goto raise_neg_overflow;
30992 if (likely(PyLong_Check(x))) {
30994 #if CYTHON_USE_PYLONG_INTERNALS
30995 const digit* digits = ((PyLongObject*)x)->ob_digit;
30996 switch (Py_SIZE(x)) {
30998 case 1: __PYX_VERIFY_RETURN_INT(
LongIndexType, digit, digits[0])
31001 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31002 __PYX_VERIFY_RETURN_INT(
LongIndexType,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31003 }
else if (8 *
sizeof(
LongIndexType) >= 2 * PyLong_SHIFT) {
31010 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31011 __PYX_VERIFY_RETURN_INT(
LongIndexType,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31012 }
else if (8 *
sizeof(
LongIndexType) >= 3 * PyLong_SHIFT) {
31019 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31020 __PYX_VERIFY_RETURN_INT(
LongIndexType,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31021 }
else if (8 *
sizeof(
LongIndexType) >= 4 * PyLong_SHIFT) {
31028 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
31029 if (unlikely(Py_SIZE(x) < 0)) {
31030 goto raise_neg_overflow;
31034 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
31035 if (unlikely(result < 0))
31037 if (unlikely(result == 1))
31038 goto raise_neg_overflow;
31042 __PYX_VERIFY_RETURN_INT_EXC(
LongIndexType,
unsigned long, PyLong_AsUnsignedLong(x))
31043 #ifdef HAVE_LONG_LONG
31044 }
else if (
sizeof(
LongIndexType) <=
sizeof(
unsigned PY_LONG_LONG)) {
31045 __PYX_VERIFY_RETURN_INT_EXC(
LongIndexType,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
31049 #if CYTHON_USE_PYLONG_INTERNALS
31050 const digit* digits = ((PyLongObject*)x)->ob_digit;
31051 switch (Py_SIZE(x)) {
31053 case -1: __PYX_VERIFY_RETURN_INT(
LongIndexType, sdigit, (sdigit) (-(sdigit)digits[0]))
31054 case 1: __PYX_VERIFY_RETURN_INT(
LongIndexType, digit, +digits[0])
31057 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31058 __PYX_VERIFY_RETURN_INT(
LongIndexType,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31059 }
else if (8 *
sizeof(
LongIndexType) - 1 > 2 * PyLong_SHIFT) {
31066 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31067 __PYX_VERIFY_RETURN_INT(
LongIndexType,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31068 }
else if (8 *
sizeof(
LongIndexType) - 1 > 2 * PyLong_SHIFT) {
31075 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31076 __PYX_VERIFY_RETURN_INT(
LongIndexType,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31077 }
else if (8 *
sizeof(
LongIndexType) - 1 > 3 * PyLong_SHIFT) {
31084 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31085 __PYX_VERIFY_RETURN_INT(
LongIndexType,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31086 }
else if (8 *
sizeof(
LongIndexType) - 1 > 3 * PyLong_SHIFT) {
31093 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31094 __PYX_VERIFY_RETURN_INT(
LongIndexType,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31095 }
else if (8 *
sizeof(
LongIndexType) - 1 > 4 * PyLong_SHIFT) {
31102 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31103 __PYX_VERIFY_RETURN_INT(
LongIndexType,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31104 }
else if (8 *
sizeof(
LongIndexType) - 1 > 4 * PyLong_SHIFT) {
31112 __PYX_VERIFY_RETURN_INT_EXC(
LongIndexType,
long, PyLong_AsLong(x))
31113 #ifdef HAVE_LONG_LONG
31114 }
else if (
sizeof(
LongIndexType) <=
sizeof(PY_LONG_LONG)) {
31115 __PYX_VERIFY_RETURN_INT_EXC(
LongIndexType, PY_LONG_LONG, PyLong_AsLongLong(x))
31120 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
31121 PyErr_SetString(PyExc_RuntimeError,
31122 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
31125 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
31126 #if PY_MAJOR_VERSION < 3
31127 if (likely(v) && !PyLong_Check(v)) {
31129 v = PyNumber_Long(tmp);
31134 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
31135 unsigned char *bytes = (
unsigned char *)&val;
31136 int ret = _PyLong_AsByteArray((PyLongObject *)v,
31137 bytes,
sizeof(val),
31138 is_little, !is_unsigned);
31148 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
31150 val = __Pyx_PyInt_As_LongIndexType(tmp);
31155 PyErr_SetString(PyExc_OverflowError,
31156 "value too large to convert to LongIndexType");
31158 raise_neg_overflow:
31159 PyErr_SetString(PyExc_OverflowError,
31160 "can't convert negative value to LongIndexType");
31165 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
31166 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31167 #pragma GCC diagnostic push
31168 #pragma GCC diagnostic ignored "-Wconversion"
31170 const int neg_one = (int) -1, const_zero = (
int) 0;
31171 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31172 #pragma GCC diagnostic pop
31174 const int is_unsigned = neg_one > const_zero;
31175 #if PY_MAJOR_VERSION < 3
31176 if (likely(PyInt_Check(x))) {
31177 if (
sizeof(
int) <
sizeof(long)) {
31178 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
31180 long val = PyInt_AS_LONG(x);
31181 if (is_unsigned && unlikely(val < 0)) {
31182 goto raise_neg_overflow;
31188 if (likely(PyLong_Check(x))) {
31190 #if CYTHON_USE_PYLONG_INTERNALS
31191 const digit* digits = ((PyLongObject*)x)->ob_digit;
31192 switch (Py_SIZE(x)) {
31193 case 0:
return (
int) 0;
31194 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
31196 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
31197 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31198 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31199 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
31200 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
31205 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
31206 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31207 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31208 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
31209 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
31214 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
31215 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31216 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31217 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
31218 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
31224 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
31225 if (unlikely(Py_SIZE(x) < 0)) {
31226 goto raise_neg_overflow;
31230 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
31231 if (unlikely(result < 0))
31233 if (unlikely(result == 1))
31234 goto raise_neg_overflow;
31237 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
31238 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
31239 #ifdef HAVE_LONG_LONG
31240 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
31241 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
31245 #if CYTHON_USE_PYLONG_INTERNALS
31246 const digit* digits = ((PyLongObject*)x)->ob_digit;
31247 switch (Py_SIZE(x)) {
31248 case 0:
return (
int) 0;
31249 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
31250 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
31252 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
31253 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31254 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31255 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
31256 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
31261 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
31262 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31263 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31264 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
31265 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
31270 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
31271 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31272 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31273 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
31274 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
31279 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
31280 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31281 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31282 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
31283 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
31288 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
31289 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31290 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31291 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
31292 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
31297 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
31298 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31299 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31300 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
31301 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
31307 if (
sizeof(
int) <=
sizeof(long)) {
31308 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
31309 #ifdef HAVE_LONG_LONG
31310 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
31311 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
31316 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
31317 PyErr_SetString(PyExc_RuntimeError,
31318 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
31321 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
31322 #if PY_MAJOR_VERSION < 3
31323 if (likely(v) && !PyLong_Check(v)) {
31325 v = PyNumber_Long(tmp);
31330 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
31331 unsigned char *bytes = (
unsigned char *)&val;
31332 int ret = _PyLong_AsByteArray((PyLongObject *)v,
31333 bytes,
sizeof(val),
31334 is_little, !is_unsigned);
31344 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
31345 if (!tmp)
return (
int) -1;
31346 val = __Pyx_PyInt_As_int(tmp);
31351 PyErr_SetString(PyExc_OverflowError,
31352 "value too large to convert to int");
31354 raise_neg_overflow:
31355 PyErr_SetString(PyExc_OverflowError,
31356 "can't convert negative value to int");
31361 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
31362 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31363 #pragma GCC diagnostic push
31364 #pragma GCC diagnostic ignored "-Wconversion"
31366 const int neg_one = (int) -1, const_zero = (
int) 0;
31367 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31368 #pragma GCC diagnostic pop
31370 const int is_unsigned = neg_one > const_zero;
31372 if (
sizeof(
int) <
sizeof(long)) {
31373 return PyInt_FromLong((
long) value);
31374 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
31375 return PyLong_FromUnsignedLong((
unsigned long) value);
31376 #ifdef HAVE_LONG_LONG
31377 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
31378 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
31382 if (
sizeof(
int) <=
sizeof(
long)) {
31383 return PyInt_FromLong((
long) value);
31384 #ifdef HAVE_LONG_LONG
31385 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
31386 return PyLong_FromLongLong((PY_LONG_LONG) value);
31391 int one = 1;
int little = (int)*(
unsigned char *)&one;
31392 unsigned char *bytes = (
unsigned char *)&value;
31393 return _PyLong_FromByteArray(bytes,
sizeof(
int),
31394 little, !is_unsigned);
31399 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
31400 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31401 #pragma GCC diagnostic push
31402 #pragma GCC diagnostic ignored "-Wconversion"
31404 const long neg_one = (long) -1, const_zero = (
long) 0;
31405 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31406 #pragma GCC diagnostic pop
31408 const int is_unsigned = neg_one > const_zero;
31409 #if PY_MAJOR_VERSION < 3
31410 if (likely(PyInt_Check(x))) {
31411 if (
sizeof(
long) <
sizeof(long)) {
31412 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
31414 long val = PyInt_AS_LONG(x);
31415 if (is_unsigned && unlikely(val < 0)) {
31416 goto raise_neg_overflow;
31422 if (likely(PyLong_Check(x))) {
31424 #if CYTHON_USE_PYLONG_INTERNALS
31425 const digit* digits = ((PyLongObject*)x)->ob_digit;
31426 switch (Py_SIZE(x)) {
31427 case 0:
return (
long) 0;
31428 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
31430 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
31431 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31432 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31433 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
31434 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
31439 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
31440 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31441 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31442 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
31443 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
31448 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
31449 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31450 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31451 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
31452 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
31458 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
31459 if (unlikely(Py_SIZE(x) < 0)) {
31460 goto raise_neg_overflow;
31464 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
31465 if (unlikely(result < 0))
31467 if (unlikely(result == 1))
31468 goto raise_neg_overflow;
31471 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
31472 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
31473 #ifdef HAVE_LONG_LONG
31474 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
31475 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
31479 #if CYTHON_USE_PYLONG_INTERNALS
31480 const digit* digits = ((PyLongObject*)x)->ob_digit;
31481 switch (Py_SIZE(x)) {
31482 case 0:
return (
long) 0;
31483 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
31484 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
31486 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
31487 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31488 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31489 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
31490 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
31495 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
31496 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31497 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31498 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
31499 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
31504 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
31505 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31506 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31507 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
31508 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
31513 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
31514 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31515 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31516 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
31517 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
31522 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
31523 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31524 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31525 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
31526 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
31531 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
31532 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31533 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31534 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
31535 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
31541 if (
sizeof(
long) <=
sizeof(long)) {
31542 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
31543 #ifdef HAVE_LONG_LONG
31544 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
31545 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
31550 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
31551 PyErr_SetString(PyExc_RuntimeError,
31552 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
31555 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
31556 #if PY_MAJOR_VERSION < 3
31557 if (likely(v) && !PyLong_Check(v)) {
31559 v = PyNumber_Long(tmp);
31564 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
31565 unsigned char *bytes = (
unsigned char *)&val;
31566 int ret = _PyLong_AsByteArray((PyLongObject *)v,
31567 bytes,
sizeof(val),
31568 is_little, !is_unsigned);
31578 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
31579 if (!tmp)
return (
long) -1;
31580 val = __Pyx_PyInt_As_long(tmp);
31585 PyErr_SetString(PyExc_OverflowError,
31586 "value too large to convert to long");
31588 raise_neg_overflow:
31589 PyErr_SetString(PyExc_OverflowError,
31590 "can't convert negative value to long");
31595 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *x) {
31596 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31597 #pragma GCC diagnostic push
31598 #pragma GCC diagnostic ignored "-Wconversion"
31600 const char neg_one = (char) -1, const_zero = (
char) 0;
31601 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31602 #pragma GCC diagnostic pop
31604 const int is_unsigned = neg_one > const_zero;
31605 #if PY_MAJOR_VERSION < 3
31606 if (likely(PyInt_Check(x))) {
31607 if (
sizeof(
char) <
sizeof(long)) {
31608 __PYX_VERIFY_RETURN_INT(
char,
long, PyInt_AS_LONG(x))
31610 long val = PyInt_AS_LONG(x);
31611 if (is_unsigned && unlikely(val < 0)) {
31612 goto raise_neg_overflow;
31618 if (likely(PyLong_Check(x))) {
31620 #if CYTHON_USE_PYLONG_INTERNALS
31621 const digit* digits = ((PyLongObject*)x)->ob_digit;
31622 switch (Py_SIZE(x)) {
31623 case 0:
return (
char) 0;
31624 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, digits[0])
31626 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
31627 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31628 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31629 }
else if (8 *
sizeof(
char) >= 2 * PyLong_SHIFT) {
31630 return (
char) (((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
31635 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
31636 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31637 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31638 }
else if (8 *
sizeof(
char) >= 3 * PyLong_SHIFT) {
31639 return (
char) (((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
31644 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
31645 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31646 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31647 }
else if (8 *
sizeof(
char) >= 4 * PyLong_SHIFT) {
31648 return (
char) (((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
31654 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
31655 if (unlikely(Py_SIZE(x) < 0)) {
31656 goto raise_neg_overflow;
31660 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
31661 if (unlikely(result < 0))
31663 if (unlikely(result == 1))
31664 goto raise_neg_overflow;
31667 if (
sizeof(
char) <=
sizeof(
unsigned long)) {
31668 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned long, PyLong_AsUnsignedLong(x))
31669 #ifdef HAVE_LONG_LONG
31670 }
else if (
sizeof(
char) <=
sizeof(
unsigned PY_LONG_LONG)) {
31671 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
31675 #if CYTHON_USE_PYLONG_INTERNALS
31676 const digit* digits = ((PyLongObject*)x)->ob_digit;
31677 switch (Py_SIZE(x)) {
31678 case 0:
return (
char) 0;
31679 case -1: __PYX_VERIFY_RETURN_INT(
char, sdigit, (sdigit) (-(sdigit)digits[0]))
31680 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, +digits[0])
31682 if (8 *
sizeof(
char) - 1 > 1 * PyLong_SHIFT) {
31683 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31684 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31685 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
31686 return (
char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
31691 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
31692 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
31693 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31694 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
31695 return (
char) ((((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
31700 if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
31701 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31702 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31703 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
31704 return (
char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
31709 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
31710 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
31711 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31712 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
31713 return (
char) ((((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
31718 if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
31719 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31720 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31721 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
31722 return (
char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
31727 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
31728 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
31729 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
31730 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
31731 return (
char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
31737 if (
sizeof(
char) <=
sizeof(long)) {
31738 __PYX_VERIFY_RETURN_INT_EXC(
char,
long, PyLong_AsLong(x))
31739 #ifdef HAVE_LONG_LONG
31740 }
else if (
sizeof(
char) <=
sizeof(PY_LONG_LONG)) {
31741 __PYX_VERIFY_RETURN_INT_EXC(
char, PY_LONG_LONG, PyLong_AsLongLong(x))
31746 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
31747 PyErr_SetString(PyExc_RuntimeError,
31748 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
31751 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
31752 #if PY_MAJOR_VERSION < 3
31753 if (likely(v) && !PyLong_Check(v)) {
31755 v = PyNumber_Long(tmp);
31760 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
31761 unsigned char *bytes = (
unsigned char *)&val;
31762 int ret = _PyLong_AsByteArray((PyLongObject *)v,
31763 bytes,
sizeof(val),
31764 is_little, !is_unsigned);
31774 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
31775 if (!tmp)
return (
char) -1;
31776 val = __Pyx_PyInt_As_char(tmp);
31781 PyErr_SetString(PyExc_OverflowError,
31782 "value too large to convert to char");
31784 raise_neg_overflow:
31785 PyErr_SetString(PyExc_OverflowError,
31786 "can't convert negative value to char");
31791 static int __Pyx_check_binary_version(
void) {
31793 int same=1, i, found_dot;
31794 const char* rt_from_call = Py_GetVersion();
31795 PyOS_snprintf(ctversion, 5,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
31797 for (i = 0; i < 4; i++) {
31798 if (!ctversion[i]) {
31799 same = (rt_from_call[i] <
'0' || rt_from_call[i] >
'9');
31802 if (rt_from_call[i] != ctversion[i]) {
31808 char rtversion[5] = {
'\0'};
31810 for (i=0; i<4; ++i) {
31811 if (rt_from_call[i] ==
'.') {
31812 if (found_dot)
break;
31814 }
else if (rt_from_call[i] <
'0' || rt_from_call[i] >
'9') {
31817 rtversion[i] = rt_from_call[i];
31819 PyOS_snprintf(message,
sizeof(message),
31820 "compiletime version %s of module '%.100s' "
31821 "does not match runtime version %s",
31822 ctversion, __Pyx_MODULE_NAME, rtversion);
31823 return PyErr_WarnEx(NULL, message, 1);
31829 #ifndef __PYX_HAVE_RT_ImportFunction_0_29_36
31830 #define __PYX_HAVE_RT_ImportFunction_0_29_36
31831 static int __Pyx_ImportFunction_0_29_36(PyObject *module,
const char *funcname,
void (**f)(
void),
const char *sig) {
31833 PyObject *cobj = 0;
31838 d = PyObject_GetAttrString(module, (
char *)
"__pyx_capi__");
31841 cobj = PyDict_GetItemString(d, funcname);
31843 PyErr_Format(PyExc_ImportError,
31844 "%.200s does not export expected C function %.200s",
31845 PyModule_GetName(module), funcname);
31848 #if PY_VERSION_HEX >= 0x02070000
31849 if (!PyCapsule_IsValid(cobj, sig)) {
31850 PyErr_Format(PyExc_TypeError,
31851 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
31852 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
31855 tmp.p = PyCapsule_GetPointer(cobj, sig);
31857 {
const char *desc, *s1, *s2;
31858 desc = (
const char *)PyCObject_GetDesc(cobj);
31861 s1 = desc; s2 = sig;
31862 while (*s1 !=
'\0' && *s1 == *s2) { s1++; s2++; }
31864 PyErr_Format(PyExc_TypeError,
31865 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
31866 PyModule_GetName(module), funcname, sig, desc);
31869 tmp.p = PyCObject_AsVoidPtr(cobj);}
31883 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
31885 #if PY_MAJOR_VERSION < 3
31886 if (t->is_unicode) {
31887 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
31888 }
else if (t->intern) {
31889 *t->p = PyString_InternFromString(t->s);
31891 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
31894 if (t->is_unicode | t->is_str) {
31896 *t->p = PyUnicode_InternFromString(t->s);
31897 }
else if (t->encoding) {
31898 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
31900 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
31903 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
31908 if (PyObject_Hash(*t->p) == -1)
31915 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
31916 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
31918 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
31920 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
31922 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
31923 #if !CYTHON_PEP393_ENABLED
31924 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
31926 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
31927 if (!defenc)
return NULL;
31928 defenc_c = PyBytes_AS_STRING(defenc);
31929 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
31931 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
31933 for (c = defenc_c; c < end; c++) {
31934 if ((
unsigned char) (*c) >= 128) {
31935 PyUnicode_AsASCIIString(o);
31941 *length = PyBytes_GET_SIZE(defenc);
31945 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
31946 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
31947 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
31948 if (likely(PyUnicode_IS_ASCII(o))) {
31949 *length = PyUnicode_GET_LENGTH(o);
31950 return PyUnicode_AsUTF8(o);
31952 PyUnicode_AsASCIIString(o);
31956 return PyUnicode_AsUTF8AndSize(o, length);
31961 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
31962 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
31964 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
31965 __Pyx_sys_getdefaultencoding_not_ascii &&
31967 PyUnicode_Check(o)) {
31968 return __Pyx_PyUnicode_AsStringAndSize(o, length);
31971 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
31972 if (PyByteArray_Check(o)) {
31973 *length = PyByteArray_GET_SIZE(o);
31974 return PyByteArray_AS_STRING(o);
31979 int r = PyBytes_AsStringAndSize(o, &result, length);
31980 if (unlikely(r < 0)) {
31987 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
31988 int is_true = x == Py_True;
31989 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
31990 else return PyObject_IsTrue(x);
31992 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
31994 if (unlikely(!x))
return -1;
31995 retval = __Pyx_PyObject_IsTrue(x);
31999 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
32000 #if PY_MAJOR_VERSION >= 3
32001 if (PyLong_Check(result)) {
32002 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
32003 "__int__ returned non-int (type %.200s). "
32004 "The ability to return an instance of a strict subclass of int "
32005 "is deprecated, and may be removed in a future version of Python.",
32006 Py_TYPE(result)->tp_name)) {
32013 PyErr_Format(PyExc_TypeError,
32014 "__%.4s__ returned non-%.4s (type %.200s)",
32015 type_name, type_name, Py_TYPE(result)->tp_name);
32019 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
32020 #if CYTHON_USE_TYPE_SLOTS
32021 PyNumberMethods *m;
32023 const char *name = NULL;
32024 PyObject *res = NULL;
32025 #if PY_MAJOR_VERSION < 3
32026 if (likely(PyInt_Check(x) || PyLong_Check(x)))
32028 if (likely(PyLong_Check(x)))
32030 return __Pyx_NewRef(x);
32031 #if CYTHON_USE_TYPE_SLOTS
32032 m = Py_TYPE(x)->tp_as_number;
32033 #if PY_MAJOR_VERSION < 3
32034 if (m && m->nb_int) {
32036 res = m->nb_int(x);
32038 else if (m && m->nb_long) {
32040 res = m->nb_long(x);
32043 if (likely(m && m->nb_int)) {
32045 res = m->nb_int(x);
32049 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
32050 res = PyNumber_Int(x);
32054 #if PY_MAJOR_VERSION < 3
32055 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
32057 if (unlikely(!PyLong_CheckExact(res))) {
32059 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
32062 else if (!PyErr_Occurred()) {
32063 PyErr_SetString(PyExc_TypeError,
32064 "an integer is required");
32068 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
32071 #if PY_MAJOR_VERSION < 3
32072 if (likely(PyInt_CheckExact(b))) {
32073 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
32074 return PyInt_AS_LONG(b);
32076 return PyInt_AsSsize_t(b);
32079 if (likely(PyLong_CheckExact(b))) {
32080 #if CYTHON_USE_PYLONG_INTERNALS
32081 const digit* digits = ((PyLongObject*)b)->ob_digit;
32082 const Py_ssize_t size = Py_SIZE(b);
32083 if (likely(__Pyx_sst_abs(size) <= 1)) {
32084 ival = likely(size) ? digits[0] : 0;
32085 if (size == -1) ival = -ival;
32090 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
32091 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
32095 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
32096 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
32100 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
32101 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
32105 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
32106 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
32110 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
32111 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
32115 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
32116 return -(Py_ssize_t) (((((((((
size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
32122 return PyLong_AsSsize_t(b);
32124 x = PyNumber_Index(b);
32126 ival = PyInt_AsSsize_t(x);
32130 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
32131 if (
sizeof(Py_hash_t) ==
sizeof(Py_ssize_t)) {
32132 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
32133 #if PY_MAJOR_VERSION < 3
32134 }
else if (likely(PyInt_CheckExact(o))) {
32135 return PyInt_AS_LONG(o);
32140 x = PyNumber_Index(o);
32142 ival = PyInt_AsLong(x);
32147 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
32148 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
32150 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
32151 return PyInt_FromSize_t(ival);
static DataType inner_product(const DataType *vector1, const DataType *vector2, const LongIndexType vector_size)
Computes Euclidean inner product of two vectors.